How to override password change form in django 1.3?

300 Views Asked by At

I must use django 1.3 and I have:

class CustomPasswordChangeForm(AdminPasswordChangeForm):

    def clean_password1(self):
        passwd = self.cleaned_data['password1']

        if passwd and len(passwd) < 6:
            raise ValidationError('password too short.')
        return passwd


class CustomUserAdmin(UserAdmin):

    change_password_form = CustomPasswordChangeForm

admin.site.unregister(User)
admin.site.register(User, CustomUserAdmin)

But in django 1.3 this not working (nothing happen - If I add my __init__ functions to classes I see that CustomUserAdmin is initialized but CustomPasswordChangeForm not). How to do it?

0

There are 0 best solutions below