Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Edited contrib.auth check messages for grammar and consistency.

  • Loading branch information...
commit 84207b6134dd4944f7549040a3825e90bc6fdc7e 1 parent 3c5fc70
Russell Keith-Magee freakboy3742 authored
15 django/contrib/auth/checks.py
View
@@ -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',
16 django/contrib/auth/tests/test_management.py
View
@@ -358,7 +358,7 @@ def test_required_fields_is_list(self):
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 @@ def test_username_not_in_required_fields(self):
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 @@ def test_username_non_unique(self):
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 @@ def test_username_non_unique_with_custom_backend(self):
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',
Please sign in to comment.
Something went wrong with that request. Please try again.