Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #22195 -- Used constants to define built-in tags for check fram…

…ework.

Thanks Elvard for the patch.
  • Loading branch information...
commit b513fa5fc6f10a6e224d602bfac8f850040cef7c 1 parent 7e3834a
@timgraham timgraham authored
View
2  django/contrib/admin/apps.py
@@ -11,7 +11,7 @@ class SimpleAdminConfig(AppConfig):
verbose_name = _("Administration")
def ready(self):
- checks.register('admin')(check_admin_app)
+ checks.register(checks.Tags.admin)(check_admin_app)
class AdminConfig(SimpleAdminConfig):
View
2  django/contrib/auth/apps.py
@@ -10,4 +10,4 @@ class AuthConfig(AppConfig):
verbose_name = _("Authentication and Authorization")
def ready(self):
- checks.register('models')(check_user_model)
+ checks.register(checks.Tags.models)(check_user_model)
View
2  django/contrib/contenttypes/apps.py
@@ -9,4 +9,4 @@ class ContentTypesConfig(AppConfig):
verbose_name = _("Content Types")
def ready(self):
- checks.register('models')(check_generic_foreign_keys)
+ checks.register(checks.Tags.models)(check_generic_foreign_keys)
View
4 django/core/checks/__init__.py
@@ -4,7 +4,7 @@
from .messages import (CheckMessage,
Debug, Info, Warning, Error, Critical,
DEBUG, INFO, WARNING, ERROR, CRITICAL)
-from .registry import register, run_checks, tag_exists
+from .registry import register, run_checks, tag_exists, Tags
# Import these to force registration of checks
import django.core.checks.compatibility.django_1_6_0 # NOQA
@@ -14,5 +14,5 @@
'CheckMessage',
'Debug', 'Info', 'Warning', 'Error', 'Critical',
'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL',
- 'register', 'run_checks', 'tag_exists',
+ 'register', 'run_checks', 'tag_exists', 'Tags',
]
View
4 django/core/checks/compatibility/django_1_6_0.py
@@ -3,10 +3,10 @@
from django.apps import apps
-from .. import Warning, register
+from .. import Warning, register, Tags
-@register('compatibility')
+@register(Tags.compatibility)
def check_1_6_compatibility(**kwargs):
errors = []
errors.extend(_check_test_runner(**kwargs))
View
6 django/core/checks/model_checks.py
@@ -6,10 +6,10 @@
from django.apps import apps
-from . import Error, register
+from . import Error, Tags, register
-@register('models')
+@register(Tags.models)
def check_all_models(app_configs=None, **kwargs):
errors = [model.check(**kwargs)
for model in apps.get_models()
@@ -17,7 +17,7 @@ def check_all_models(app_configs=None, **kwargs):
return list(chain(*errors))
-@register('models', 'signals')
+@register(Tags.models, Tags.signals)
def check_model_signals(app_configs=None, **kwargs):
"""Ensure lazily referenced model signals senders are installed."""
from django.db import models
View
10 django/core/checks/registry.py
@@ -6,6 +6,16 @@
from django.utils.itercompat import is_iterable
+class Tags(object):
+ """
+ Built-in tags for internal checks.
+ """
+ admin = 'admin'
+ compatibility = 'compatibility'
+ models = 'models'
+ signals = 'signals'
+
+
class CheckRegistry(object):
def __init__(self):
Please sign in to comment.
Something went wrong with that request. Please try again.