1
0
mirror of https://github.com/django/django.git synced 2025-07-07 03:09:22 +00:00

[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
This commit is contained in:
Honza Král 2010-01-04 01:57:36 +00:00
parent a3ad787308
commit 891c34ddd0

View File

@ -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: