Fixed #31289 -- Added hint for USERNAME_FIELD/REQUIRED_FIELDS system check.
This commit is contained in:
parent
5637933268
commit
fba5d3b6e6
|
@ -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…
Reference in New Issue