Ticket #13147: 13147.diff
File 13147.diff, 1.1 KB (added by , 14 years ago) |
---|
-
django/contrib/auth/tests/forms.py
16 16 >>> form.is_valid() 17 17 False 18 18 >>> form["username"].errors 19 [u' A user with that username already exists.']19 [u'User with this Username already exists.'] 20 20 21 21 # The username contains invalid data. 22 22 -
django/contrib/auth/forms.py
22 22 model = User 23 23 fields = ("username",) 24 24 25 def clean_username(self):26 username = self.cleaned_data["username"]27 try:28 User.objects.get(username=username)29 except User.DoesNotExist:30 return username31 raise forms.ValidationError(_("A user with that username already exists."))32 33 25 def clean_password2(self): 34 26 password1 = self.cleaned_data.get("password1", "") 35 27 password2 = self.cleaned_data["password2"]