pagination bug #9038
-
ChecklistIncoming page_size not effective The page should be added on line 178 of the pagination. py file 'page_size_query_param = None' changed to page_size_query_param = 'page_size' |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
can you please share more detail? |
Beta Was this translation helpful? Give feedback.
-
@zcjwin, it is described in the documentation that the default value of
But you can set REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 100
} Even you can modify this behavior of class MyPageNumberPagination(PageNumberPagination):
page_size = 100
page_size_query_param = 'page_size'
max_page_size = 1000 then use it in your View class like this class MyView(generics.ListAPIView):
...
pagination_class = MyPageNumberPagination Even you can use this custom pagination class globally REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'apps.core.pagination.MyPageNumberPagination'
} |
Beta Was this translation helpful? Give feedback.
@zcjwin, it is described in the documentation that the default value of
page_size_query_param
isNone
so that the client may not control the requested page size.ref: Official documentation
But you can set
PAGE_SIZE
globally in your settings. Example:Even you can modify this behavior of
PageNumberPagination
by creating…