Edited contrib.auth check messages for grammar and consistency.
This commit is contained in:
parent
3c5fc708f1
commit
84207b6134
|
@ -15,7 +15,7 @@ def check_user_model(**kwargs):
|
|||
if not isinstance(cls.REQUIRED_FIELDS, (list, tuple)):
|
||||
errors.append(
|
||||
checks.Error(
|
||||
'The REQUIRED_FIELDS must be a list or tuple.',
|
||||
"'REQUIRED_FIELDS' must be a list or tuple.",
|
||||
hint=None,
|
||||
obj=cls,
|
||||
id='auth.E001',
|
||||
|
@ -26,9 +26,8 @@ def check_user_model(**kwargs):
|
|||
if cls.USERNAME_FIELD in cls.REQUIRED_FIELDS:
|
||||
errors.append(
|
||||
checks.Error(
|
||||
('The field named as the USERNAME_FIELD '
|
||||
'must not be included in REQUIRED_FIELDS '
|
||||
'on a custom user model.'),
|
||||
("The field named as the 'USERNAME_FIELD' "
|
||||
"for a custom user model must not be included in 'REQUIRED_FIELDS'."),
|
||||
hint=None,
|
||||
obj=cls,
|
||||
id='auth.E002',
|
||||
|
@ -41,8 +40,7 @@ def check_user_model(**kwargs):
|
|||
('django.contrib.auth.backends.ModelBackend',)):
|
||||
errors.append(
|
||||
checks.Error(
|
||||
('The %s.%s field must be unique because it is '
|
||||
'pointed to by USERNAME_FIELD.') % (
|
||||
"'%s.%s' must be unique because it is named as the 'USERNAME_FIELD'." % (
|
||||
cls._meta.object_name, cls.USERNAME_FIELD
|
||||
),
|
||||
hint=None,
|
||||
|
@ -53,11 +51,10 @@ def check_user_model(**kwargs):
|
|||
else:
|
||||
errors.append(
|
||||
checks.Warning(
|
||||
('The %s.%s field is pointed to by USERNAME_FIELD, '
|
||||
'but it is not unique.') % (
|
||||
"'%s.%s' is named as the 'USERNAME_FIELD', but it is not unique." % (
|
||||
cls._meta.object_name, cls.USERNAME_FIELD
|
||||
),
|
||||
hint=('Ensure that your authentication backend can handle '
|
||||
hint=('Ensure that your authentication backend(s) can handle '
|
||||
'non-unique usernames.'),
|
||||
obj=cls,
|
||||
id='auth.W004',
|
||||
|
|
|
@ -358,7 +358,7 @@ class CustomUserModelValidationTestCase(TestCase):
|
|||
errors = checks.run_checks()
|
||||
expected = [
|
||||
checks.Error(
|
||||
'The REQUIRED_FIELDS must be a list or tuple.',
|
||||
"'REQUIRED_FIELDS' must be a list or tuple.",
|
||||
hint=None,
|
||||
obj=CustomUserNonListRequiredFields,
|
||||
id='auth.E001',
|
||||
|
@ -375,8 +375,8 @@ class CustomUserModelValidationTestCase(TestCase):
|
|||
errors = checks.run_checks()
|
||||
expected = [
|
||||
checks.Error(
|
||||
('The field named as the USERNAME_FIELD must not be included '
|
||||
'in REQUIRED_FIELDS on a custom user model.'),
|
||||
("The field named as the 'USERNAME_FIELD' for a custom user model "
|
||||
"must not be included in 'REQUIRED_FIELDS'."),
|
||||
hint=None,
|
||||
obj=CustomUserBadRequiredFields,
|
||||
id='auth.E002',
|
||||
|
@ -393,8 +393,8 @@ class CustomUserModelValidationTestCase(TestCase):
|
|||
errors = checks.run_checks()
|
||||
expected = [
|
||||
checks.Error(
|
||||
('The CustomUserNonUniqueUsername.username field must be '
|
||||
'unique because it is pointed to by USERNAME_FIELD.'),
|
||||
("'CustomUserNonUniqueUsername.username' must be "
|
||||
"unique because it is named as the 'USERNAME_FIELD'."),
|
||||
hint=None,
|
||||
obj=CustomUserNonUniqueUsername,
|
||||
id='auth.E003',
|
||||
|
@ -416,9 +416,9 @@ class CustomUserModelValidationTestCase(TestCase):
|
|||
errors = checks.run_checks()
|
||||
expected = [
|
||||
checks.Warning(
|
||||
('The CustomUserNonUniqueUsername.username field is pointed to '
|
||||
'by USERNAME_FIELD, but it is not unique.'),
|
||||
hint=('Ensure that your authentication backend can handle '
|
||||
("'CustomUserNonUniqueUsername.username' is named as "
|
||||
"the 'USERNAME_FIELD', but it is not unique."),
|
||||
hint=('Ensure that your authentication backend(s) can handle '
|
||||
'non-unique usernames.'),
|
||||
obj=CustomUserNonUniqueUsername,
|
||||
id='auth.W004',
|
||||
|
|
Loading…
Reference in New Issue