mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
revised language and approach to import the system check
Adds a rest framework app config.
This commit is contained in:
parent
f34da6dec0
commit
7a0a5c38b3
|
@ -6,7 +6,6 @@ ______ _____ _____ _____ __
|
||||||
| |\ \| |___/\__/ / | | | | | | | (_| | | | | | | __/\ V V / (_) | | | <
|
| |\ \| |___/\__/ / | | | | | | | (_| | | | | | | __/\ V V / (_) | | | <
|
||||||
\_| \_\____/\____/ \_/ |_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_|
|
\_| \_\____/\____/ \_/ |_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_|
|
||||||
"""
|
"""
|
||||||
from .checks import * # NOQA
|
|
||||||
|
|
||||||
__title__ = 'Django REST framework'
|
__title__ = 'Django REST framework'
|
||||||
__version__ = '3.6.3'
|
__version__ = '3.6.3'
|
||||||
|
@ -22,3 +21,5 @@ HTTP_HEADER_ENCODING = 'iso-8859-1'
|
||||||
|
|
||||||
# Default datetime input and output formats
|
# Default datetime input and output formats
|
||||||
ISO_8601 = 'iso-8601'
|
ISO_8601 = 'iso-8601'
|
||||||
|
|
||||||
|
default_app_config = 'rest_framework.apps.RestFrameworkConfig'
|
||||||
|
|
10
rest_framework/apps.py
Normal file
10
rest_framework/apps.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class RestFrameworkConfig(AppConfig):
|
||||||
|
name = 'rest_framework'
|
||||||
|
verbose_name = "Django REST framework"
|
||||||
|
|
||||||
|
def ready(self):
|
||||||
|
# Add System checks
|
||||||
|
from .checks import pagination_system_check # NOQA
|
|
@ -9,12 +9,10 @@ def pagination_system_check(app_configs, **kwargs):
|
||||||
if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS:
|
if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS:
|
||||||
errors.append(
|
errors.append(
|
||||||
Warning(
|
Warning(
|
||||||
"You have specified a default `PAGE_SIZE` pagination rest_framework setting,"
|
"You have specified a default PAGE_SIZE pagination rest_framework setting,"
|
||||||
"without specifying also a `DEFAULT_PAGINATION_CLASS`.",
|
"without specifying also a DEFAULT_PAGINATION_CLASS.",
|
||||||
hint="The prior version of rest_framework defaulted this setting to "
|
hint="The default for DEFAULT_PAGINATION_CLASS is None. "
|
||||||
"`PageNumberPagination` however pagination defaults to disabled now. "
|
"In previous versions this was PageNumberPagination",
|
||||||
"Consider specifying `DEFAULT_PAGINATION_CLASS` explicitly for your project, "
|
|
||||||
"unless you specify individual pagination_class values on specific view classes.",
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return errors
|
return errors
|
||||||
|
|
Loading…
Reference in New Issue
Block a user