Ticket #13147: 13147.diff

File 13147.diff, 1.1 KB (added by Jeff Schenck, 14 years ago)

Patch for 13147

  • django/contrib/auth/tests/forms.py

     
    1616>>> form.is_valid()
    1717False
    1818>>> form["username"].errors
    19 [u'A user with that username already exists.']
     19[u'User with this Username already exists.']
    2020
    2121# The username contains invalid data.
    2222
  • django/contrib/auth/forms.py

     
    2222        model = User
    2323        fields = ("username",)
    2424
    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 username
    31         raise forms.ValidationError(_("A user with that username already exists."))
    32 
    3325    def clean_password2(self):
    3426        password1 = self.cleaned_data.get("password1", "")
    3527        password2 = self.cleaned_data["password2"]
Back to Top