summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2020-05-25 16:41:24 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-05-25 21:14:32 +0200
commit18759b2209ff556aed7f20d83cbf23e3d234e41c (patch)
treee43c6ebd3587209a30f4fb7132b27062303f0e8d
parentf24b59267be2e5fc5bd1252efda3aed19f860813 (diff)
Fixed #31616 -- Added hint about middleware ordering for SessionMiddleware admin check.
-rw-r--r--django/contrib/admin/checks.py6
-rw-r--r--tests/admin_checks/tests.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py
index 5e4b785c33..a18ba22b46 100644
--- a/django/contrib/admin/checks.py
+++ b/django/contrib/admin/checks.py
@@ -132,6 +132,12 @@ def check_dependencies(**kwargs):
errors.append(checks.Error(
"'django.contrib.sessions.middleware.SessionMiddleware' must "
"be in MIDDLEWARE in order to use the admin application.",
+ hint=(
+ "Insert "
+ "'django.contrib.sessions.middleware.SessionMiddleware' "
+ "before "
+ "'django.contrib.auth.middleware.AuthenticationMiddleware'."
+ ),
id='admin.E410',
))
return errors
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py
index 52f2188c9f..5744dc1b39 100644
--- a/tests/admin_checks/tests.py
+++ b/tests/admin_checks/tests.py
@@ -214,6 +214,12 @@ class SystemChecksTestCase(SimpleTestCase):
checks.Error(
"'django.contrib.sessions.middleware.SessionMiddleware' "
"must be in MIDDLEWARE in order to use the admin application.",
+ hint=(
+ "Insert "
+ "'django.contrib.sessions.middleware.SessionMiddleware' "
+ "before "
+ "'django.contrib.auth.middleware.AuthenticationMiddleware'."
+ ),
id='admin.E410',
),
]