aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/pagination.md
diff options
context:
space:
mode:
authorTom Christie2013-08-28 12:55:49 +0100
committerTom Christie2013-08-28 12:55:49 +0100
commit848567a0cd4f244bfe9fd68e97ae672bd259fd92 (patch)
tree171963fd43d1858cebb868bd021fac54fcbf7760 /docs/api-guide/pagination.md
parent4c53fb883fe719c3ca6244aeb8c405a24eb89a40 (diff)
downloaddjango-rest-framework-848567a0cd4f244bfe9fd68e97ae672bd259fd92.tar.bz2
Docs for `MAX_PAGINATE_BY` setting & view attribute.
Diffstat (limited to 'docs/api-guide/pagination.md')
-rw-r--r--docs/api-guide/pagination.md8
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md
index ca0174b7..0829589f 100644
--- a/docs/api-guide/pagination.md
+++ b/docs/api-guide/pagination.md
@@ -85,11 +85,12 @@ We could now use our pagination serializer in a view like this.
The generic class based views `ListAPIView` and `ListCreateAPIView` provide pagination of the returned querysets by default. You can customise this behaviour by altering the pagination style, by modifying the default number of results, by allowing clients to override the page size using a query parameter, or by turning pagination off completely.
-The default pagination style may be set globally, using the `DEFAULT_PAGINATION_SERIALIZER_CLASS`, `PAGINATE_BY` and `PAGINATE_BY_PARAM` settings. For example.
+The default pagination style may be set globally, using the `DEFAULT_PAGINATION_SERIALIZER_CLASS`, `PAGINATE_BY`, `PAGINATE_BY_PARAM`, and `MAX_PAGINATE_BY` settings. For example.
REST_FRAMEWORK = {
- 'PAGINATE_BY': 10,
- 'PAGINATE_BY_PARAM': 'page_size'
+ 'PAGINATE_BY': 10, # Default to 10
+ 'PAGINATE_BY_PARAM': 'page_size', # Allow client to override, using `?page_size=xxx`.
+ 'MAX_PAGINATE_BY': 100 # Maximum limit allowed when using `?page_size=xxx`.
}
You can also set the pagination style on a per-view basis, using the `ListAPIView` generic class-based view.
@@ -99,6 +100,7 @@ You can also set the pagination style on a per-view basis, using the `ListAPIVie
serializer_class = ExampleModelSerializer
paginate_by = 10
paginate_by_param = 'page_size'
+ max_paginate_by = 100
Note that using a `paginate_by` value of `None` will turn off pagination for the view.