summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHonza Král <honza.kral@gmail.com>2010-01-04 01:57:36 +0000
committerHonza Král <honza.kral@gmail.com>2010-01-04 01:57:36 +0000
commit891c34ddd0b4bd5e5546a787f0cdcdc481d5d271 (patch)
treeb6b0ea012ad45859ee19aca9308a87f5460ffa40
parenta3ad787308e749cb769156f95ea351e03b3d1526 (diff)
[soc2009/model-validation] avoid check for blank=True on User.password in UserCreationForm
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@12076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/auth/forms.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py
index e6eb5a736b..07e1e51c17 100644
--- a/django/contrib/auth/forms.py
+++ b/django/contrib/auth/forms.py
@@ -1,4 +1,4 @@
-from django.contrib.auth.models import User
+from django.contrib.auth.models import User, UNUSABLE_PASSWORD
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import Site
@@ -21,6 +21,11 @@ class UserCreationForm(forms.ModelForm):
model = User
fields = ("username",)
+ def clean(self):
+ # avoid check for blank=True on the model field
+ self.instance.password = UNUSABLE_PASSWORD
+ super(UserCreationForm, self).clean()
+
def clean_username(self):
username = self.cleaned_data["username"]
try: