Author: Honza_Kral
Date: 2009-06-01 10:40:35 -0500 (Mon, 01 Jun 2009)
New Revision: 10873

Modified:
   django/branches/soc2009/model-validation/django/contrib/auth/forms.py
Log:
[soc2009/model-validation] UserCreationForm made easier

Modified: django/branches/soc2009/model-validation/django/contrib/auth/forms.py
===================================================================
--- django/branches/soc2009/model-validation/django/contrib/auth/forms.py       
2009-06-01 15:40:18 UTC (rev 10872)
+++ django/branches/soc2009/model-validation/django/contrib/auth/forms.py       
2009-06-01 15:40:35 UTC (rev 10873)
@@ -34,15 +34,9 @@
         password2 = self.cleaned_data["password2"]
         if password1 != password2:
             raise forms.ValidationError(_("The two password fields didn't 
match."))
+        self.instance.set_password(password1)
         return password2
 
-    def save(self, commit=True):
-        user = super(UserCreationForm, self).save(commit=False)
-        user.set_password(self.cleaned_data["password1"])
-        if commit:
-            user.save()
-        return user
-
 class UserChangeForm(forms.ModelForm):
     username = forms.RegexField(label=_("Username"), max_length=30, 
regex=r'^\w+$',
         help_text = _("Required. 30 characters or fewer. Alphanumeric 
characters only (letters, digits and underscores)."),


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to