mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #31289 -- Added hint for USERNAME_FIELD/REQUIRED_FIELDS system check.
This commit is contained in:
parent
5637933268
commit
fba5d3b6e6
2 changed files with 9 additions and 0 deletions
|
@ -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',
|
||||
)
|
||||
|
|
|
@ -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',
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue