Skip to content
Browse files

[soc2009/model-validation] avoid check for blank=True on User.passwor…

…d in UserCreationForm

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@12076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent a3ad787 commit 891c34ddd0b4bd5e5546a787f0cdcdc481d5d271 @HonzaKral HonzaKral committed Jan 4, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 django/contrib/auth/forms.py
View
7 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 Meta:
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:

0 comments on commit 891c34d

Please sign in to comment.
Something went wrong with that request. Please try again.