mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 19:14:01 +03:00
107e8b3d23
* Changes to the paginator defaults and settings Require a default paginator be specified when using the page size setting. https://github.com/encode/django-rest-framework/issues/5168 * DRF-5168 import warnings missed this in last commit * Add a system checks file Add a check for pagination settings for the 3.7 upgrade cycle. * more compatible import approach * missing bactic * revised language and approach to import the system check Adds a rest framework app config. * Adjust doc wording
19 lines
757 B
Python
19 lines
757 B
Python
from django.core.checks import Tags, Warning, register
|
|
|
|
|
|
@register(Tags.compatibility)
|
|
def pagination_system_check(app_configs, **kwargs):
|
|
errors = []
|
|
# Use of default page size setting requires a default Paginator class
|
|
from rest_framework.settings import api_settings
|
|
if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS:
|
|
errors.append(
|
|
Warning(
|
|
"You have specified a default PAGE_SIZE pagination rest_framework setting,"
|
|
"without specifying also a DEFAULT_PAGINATION_CLASS.",
|
|
hint="The default for DEFAULT_PAGINATION_CLASS is None. "
|
|
"In previous versions this was PageNumberPagination",
|
|
)
|
|
)
|
|
return errors
|