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:
parent
a3ad787308
commit
891c34ddd0
@ -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 import authenticate
|
||||||
from django.contrib.auth.tokens import default_token_generator
|
from django.contrib.auth.tokens import default_token_generator
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
@ -21,6 +21,11 @@ class UserCreationForm(forms.ModelForm):
|
|||||||
model = User
|
model = User
|
||||||
fields = ("username",)
|
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):
|
def clean_username(self):
|
||||||
username = self.cleaned_data["username"]
|
username = self.cleaned_data["username"]
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user