Ticket #7833: 7833-take-2.diff
File 7833-take-2.diff, 1000 bytes (added by , 16 years ago) |
---|
-
django/contrib/auth/forms.py
a b class UserCreationForm(forms.ModelForm): 28 28 raise forms.ValidationError(_("A user with that username already exists.")) 29 29 30 30 def clean_password2(self): 31 password1 = self.cleaned_data ["password1"]31 password1 = self.cleaned_data.get("password1") 32 32 password2 = self.cleaned_data["password2"] 33 33 if password1 != password2: 34 34 raise forms.ValidationError(_("The two password fields didn't match.")) -
django/contrib/auth/tests/forms.py
a b False 44 44 >>> form["password2"].errors 45 45 [u"The two password fields didn't match."] 46 46 47 The first password isn't specified 48 49 >>> data = { 50 ... 'username': 'jsmith2', 51 ... 'password2': 'test123', 52 ... } 53 >>> form = UserCreationForm(data) 54 >>> form.is_valid() 55 False 56 >>> form["password1"].errors 57 [u'This field is required.'] 58 47 59 The success case. 48 60 49 61 >>> data = {