Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Explained why UserCreationForm performs custom validation of username…

…s. Refs #13147.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17225 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c7534584e8cbb33203675f92e71ec76fb5afd95c 1 parent a4e516b
@aaugustin aaugustin authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  django/contrib/auth/forms.py
View
2  django/contrib/auth/forms.py
@@ -69,6 +69,8 @@ class Meta:
fields = ("username",)
def clean_username(self):
+ # Since User.username is unique, this check is redundant,
+ # but it sets a nicer error message than the ORM. See #13147.
username = self.cleaned_data["username"]
try:
User.objects.get(username=username)
Please sign in to comment.
Something went wrong with that request. Please try again.