mirror of
https://github.com/django/django.git
synced 2025-01-03 15:06:09 +00:00
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(
|
checks.Error(
|
||||||
"The field named as the 'USERNAME_FIELD' "
|
"The field named as the 'USERNAME_FIELD' "
|
||||||
"for a custom user model must not be included in 'REQUIRED_FIELDS'.",
|
"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,
|
obj=cls,
|
||||||
id='auth.E002',
|
id='auth.E002',
|
||||||
)
|
)
|
||||||
|
@ -49,6 +49,10 @@ class UserModelChecksTests(SimpleTestCase):
|
|||||||
checks.Error(
|
checks.Error(
|
||||||
"The field named as the 'USERNAME_FIELD' for a custom user model "
|
"The field named as the 'USERNAME_FIELD' for a custom user model "
|
||||||
"must not be included in 'REQUIRED_FIELDS'.",
|
"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,
|
obj=CustomUserBadRequiredFields,
|
||||||
id='auth.E002',
|
id='auth.E002',
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user