Description
Checklist
- I have verified that that issue exists against the
master
branch of Django REST framework. - I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- This is not a usage question. (Those should be directed to the discussion group instead.)
- This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
- I have reduced the issue to the simplest possible case.
- I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)
Details
This issue is intended to discuss adding a MAX_PAGE_SIZE
pagination setting to the REST_FRAMEWORK
settings.
The default page size for paginated results can be configured by setting PAGE_SIZE
in the REST_FRAMEWORK
section of the Django settings file. However, there is no setting to configure the maximum page size from the Django settings file. The django-rest-framework could benefit from having a MAX_PAGE_SIZE
setting as well:
REST_FRAMEWORK = {
'PAGE_SIZE': 10,
'MAX_PAGE_SIZE': 1000,
...
}
Downstream issue: The django-rest-framework-json-api library by default sets the maximum page size to a value of 100, which can be overridden by a JsonApiPageNumberPagination
class. Using a class to configure the maximum page size, and using the Django configuration file to change the default page size is unnecessarily inconsistent. It would be preferable to be able to configure both settings in one place and to have this setting supported by the django-rest-framework library and not a dependent library.
Please let me know what you think about this feature request. I'm open to alternative solutions, and also open to submitting a pull request that modifies the relevant lines of the pagination module and adds documentation for the new django-rest-framework setting.