From 7a0a5c38b31901ef58c4790e59e3190b1d70c730 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Mon, 25 Sep 2017 09:16:31 -0400 Subject: [PATCH] revised language and approach to import the system check Adds a rest framework app config. --- rest_framework/__init__.py | 3 ++- rest_framework/apps.py | 10 ++++++++++ rest_framework/checks.py | 10 ++++------ 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 rest_framework/apps.py diff --git a/rest_framework/__init__.py b/rest_framework/__init__.py index 2b6c5b78d..7a5117769 100644 --- a/rest_framework/__init__.py +++ b/rest_framework/__init__.py @@ -6,7 +6,6 @@ ______ _____ _____ _____ __ | |\ \| |___/\__/ / | | | | | | | (_| | | | | | | __/\ V V / (_) | | | < \_| \_\____/\____/ \_/ |_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_| """ -from .checks import * # NOQA __title__ = 'Django REST framework' __version__ = '3.6.3' @@ -22,3 +21,5 @@ HTTP_HEADER_ENCODING = 'iso-8859-1' # Default datetime input and output formats ISO_8601 = 'iso-8601' + +default_app_config = 'rest_framework.apps.RestFrameworkConfig' diff --git a/rest_framework/apps.py b/rest_framework/apps.py new file mode 100644 index 000000000..f6013eb7e --- /dev/null +++ b/rest_framework/apps.py @@ -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 diff --git a/rest_framework/checks.py b/rest_framework/checks.py index 7ad51c1d4..af6634d1e 100644 --- a/rest_framework/checks.py +++ b/rest_framework/checks.py @@ -9,12 +9,10 @@ def pagination_system_check(app_configs, **kwargs): 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 prior version of rest_framework defaulted this setting to " - "`PageNumberPagination` however pagination defaults to disabled now. " - "Consider specifying `DEFAULT_PAGINATION_CLASS` explicitly for your project, " - "unless you specify individual pagination_class values on specific view classes.", + "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