mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 16:24:18 +03:00
Improve pagination docs. Refs #4304 [ci skip]
This commit is contained in:
parent
f0f61aa077
commit
19b415ec25
|
@ -21,12 +21,15 @@ Pagination can be turned off by setting the pagination class to `None`.
|
|||
|
||||
## Setting the pagination style
|
||||
|
||||
The default pagination style may be set globally, using the `DEFAULT_PAGINATION_CLASS` settings key. For example, to use the built-in limit/offset pagination, you would do:
|
||||
The default pagination style may be set globally, using the `DEFAULT_PAGINATION_CLASS` and `PAGE_SIZE` setting keys. For example, to use the built-in limit/offset pagination, you would do something like this:
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination'
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
|
||||
'PAGE_SIZE': 100
|
||||
}
|
||||
|
||||
Note that you need to set both the pagination class, and the page size that should be used.
|
||||
|
||||
You can also set the pagination class on an individual view by using the `pagination_class` attribute. Typically you'll want to use the same pagination style throughout your API, although you might want to vary individual aspects of the pagination, such as default or maximum page size, on a per-view basis.
|
||||
|
||||
## Modifying the pagination style
|
||||
|
|
Loading…
Reference in New Issue
Block a user