You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change the default configuration of DEFAULT_PAGINATION_CLASS to instead be None #5168
We should change the default configuration of DEFAULT_PAGINATION_CLASS from its current default of rest_framework.pagination.PageNumberPagination. This would have parity with the PAGE_SIZE setting which is also currently set to None and has the effect of disabling the PageNumberPagination class which by default cannot be override with a query parameter because the default class has page_size_query_param = None which means the only way to enable pagination in the default behavior is to sub-class the PageNumberPagination to be able to pass a query parameter for page size, or to set the global PAGE_SIZE setting.
In addition to changing the default pagination class to be None, we would have a DeprecationWarning that alerts if PAGE_SIZE is set but the DEFAULT_PAGINATION_CLASS were None, meaning that any user that was before depending on the implicit default paginator and had set PAGE_SIZE would have to also now set the DEFAULT_PAGINATION_CLASS as well when upgrading.
I used the default pagination settings and tested querying for results with and without the page_size query parameter, I found that the default was no pagination despite it having a pagination class. I also discovered the PAGE_SIZE was the magic variable to enable pagination for the default class but LimitOffsetPagination behaved more naturally as it allows the query parameters without having PAGE_SIZE be set, othewise by default LimitOffsetPagination does not paginate when a limit is not specified.
Expected behavior
Expected behavior is that global pagination settings are either fully enabled or fully disabled. We expect to not wind up in a spot where pagination doesn't work but appears in the schema, or that it does work and does not appear in the schema.
Actual behavior
By default today it is partially disabled such that there is a pagination class but no page size and it does appear in the schema regardless when the pagination class is specified.
Activity
Changes to the paginator defaults and settings
lovelydinosaur commentedon May 29, 2017
Agreed! Will review more throughly in the lead up to 3.7.0, but #5170 looks good.
Make `DEFAULT_PAGINATION_CLASS` `None` by default. (#5170)
carltongibson commentedon Sep 25, 2017
Closed by #5170