darxsys
darxsys

Reputation: 1570

Django 'super object has no attribute clean_password1()'

I am trying to subclass Django's default usercreation form, but it fails for some reason at this function:

def clean_password1(self):
    password = self.cleaned_data['password1']
    if len(password) < 8:
        raise ValidationError('Password too short')
    return super(UserRegistrationForm, self).clean_password1()

It throws an error I put in the title on the last line of this code. I tried clean_password, clean_password(), and clean_password1(), but nothing works. Django version is 1.6.2 What is wrong?

I've looked at this question for advice.

Upvotes: 0

Views: 635

Answers (1)

Nil
Nil

Reputation: 2390

As you can see in Django's code in GitHub, there's no method called clean_password1 or clean_password. There's a method called clean_password2 though :) Since there's no special check for the password, I suggest you just write

return password

EDIT Err, yes, there's a special check, the passwords must be identical. But this check will be done anyway wathever you call it or not.

Upvotes: 3

Related Questions