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: