From 891c34ddd0b4bd5e5546a787f0cdcdc481d5d271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Mon, 4 Jan 2010 01:57:36 +0000 Subject: [PATCH] [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 --- django/contrib/auth/forms.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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: