summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/auth/checks.py5
-rw-r--r--tests/auth_tests/test_checks.py4
2 files changed, 9 insertions, 0 deletions
diff --git a/django/contrib/auth/checks.py b/django/contrib/auth/checks.py
index 163199ce54..65fc266f7e 100644
--- a/django/contrib/auth/checks.py
+++ b/django/contrib/auth/checks.py
@@ -41,6 +41,11 @@ def check_user_model(app_configs=None, **kwargs):
checks.Error(
"The field named as the 'USERNAME_FIELD' "
"for a custom user model must not be included in 'REQUIRED_FIELDS'.",
+ hint=(
+ "The 'USERNAME_FIELD' is currently set to '%s', you "
+ "should remove '%s' from the 'REQUIRED_FIELDS'."
+ % (cls.USERNAME_FIELD, cls.USERNAME_FIELD)
+ ),
obj=cls,
id='auth.E002',
)
diff --git a/tests/auth_tests/test_checks.py b/tests/auth_tests/test_checks.py
index dbcfefcbb7..cfaa4063f8 100644
--- a/tests/auth_tests/test_checks.py
+++ b/tests/auth_tests/test_checks.py
@@ -49,6 +49,10 @@ class UserModelChecksTests(SimpleTestCase):
checks.Error(
"The field named as the 'USERNAME_FIELD' for a custom user model "
"must not be included in 'REQUIRED_FIELDS'.",
+ hint=(
+ "The 'USERNAME_FIELD' is currently set to 'username', you "
+ "should remove 'username' from the 'REQUIRED_FIELDS'."
+ ),
obj=CustomUserBadRequiredFields,
id='auth.E002',
),