Skip to content

Commit 2f601f3

Browse files
committed
checks: use warnings instead of errors, add ids
Fixes https://github.com/jazzband/django-debug-toolbar/issues.
1 parent b6e2354 commit 2f601f3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

debug_toolbar/apps.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.apps import AppConfig
66
from django.conf import settings
7-
from django.core.checks import Error, register
7+
from django.core.checks import Warning, register
88
from django.middleware.gzip import GZipMiddleware
99
from django.utils.module_loading import import_string
1010
from django.utils.translation import ugettext_lazy as _
@@ -39,31 +39,34 @@ def check_middleware(app_configs, **kwargs):
3939
if not debug_toolbar_indexes:
4040
# If the toolbar does not appear, report an error.
4141
errors.append(
42-
Error(
42+
Warning(
4343
"debug_toolbar.middleware.DebugToolbarMiddleware is missing "
4444
"from %s." % setting_name,
4545
hint="Add debug_toolbar.middleware.DebugToolbarMiddleware to "
4646
"%s." % setting_name,
47+
id='ddt.W001',
4748
)
4849
)
4950
elif len(debug_toolbar_indexes) != 1:
5051
# If the toolbar appears multiple times, report an error.
5152
errors.append(
52-
Error(
53+
Warning(
5354
"debug_toolbar.middleware.DebugToolbarMiddleware occurs "
5455
"multiple times in %s." % setting_name,
5556
hint="Load debug_toolbar.middleware.DebugToolbarMiddleware only "
5657
"once in %s." % setting_name,
58+
id='ddt.W002',
5759
)
5860
)
5961
elif gzip_index is not None and debug_toolbar_indexes[0] < gzip_index:
6062
# If the toolbar appears before the gzip index, report an error.
6163
errors.append(
62-
Error(
64+
Warning(
6365
"debug_toolbar.middleware.DebugToolbarMiddleware occurs before "
6466
"django.middleware.gzip.GZipMiddleware in %s." % setting_name,
6567
hint="Move debug_toolbar.middleware.DebugToolbarMiddleware to "
6668
"after django.middleware.gzip.GZipMiddleware in %s." % setting_name,
69+
id='ddt.W003',
6770
)
6871
)
6972

0 commit comments

Comments
 (0)