Kaydet (Commit) c7534584 authored tarafından Aymeric Augustin's avatar Aymeric Augustin

Explained why UserCreationForm performs custom validation of usernames. Refs #13147.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@17225 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst a4e516b5
......@@ -69,6 +69,8 @@ class UserCreationForm(forms.ModelForm):
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment