2017-09-25 16:36:31 +03:00
|
|
|
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(
|
2020-04-21 02:40:05 +03:00
|
|
|
"You have specified a default PAGE_SIZE pagination rest_framework setting, "
|
2017-09-25 16:36:31 +03:00
|
|
|
"without specifying also a DEFAULT_PAGINATION_CLASS.",
|
|
|
|
hint="The default for DEFAULT_PAGINATION_CLASS is None. "
|
2017-10-23 13:31:59 +03:00
|
|
|
"In previous versions this was PageNumberPagination. "
|
|
|
|
"If you wish to define PAGE_SIZE globally whilst defining "
|
|
|
|
"pagination_class on a per-view basis you may silence this check.",
|
|
|
|
id="rest_framework.W001"
|
2017-09-25 16:36:31 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
return errors
|