Take the 2-minute tour ×

Has anyone ever successfully integrated django-math-captcha into django-registration?

I've changed the form in django-registration to be as such:

class RegistrationForm(MathCaptchaForm)

The form displays just fine, and it recognizes when I input anything other than numbers. However, it does not flag wrong answers. For example I input 2+1 = 6 and my registration completed just fine.

Any ideas?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

To answer my own question, it is because MathCaptchaForm.clean() was being overridden by RegistrationForm.clean(). I called super() from within RegistrationForm.clean() and it worked.

New code within RegistrationForm.clean():

def clean(self):
    super(RegistrationForm, self).clean()

    if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
        if self.cleaned_data['password1'] != self.cleaned_data['password2']:
            raise forms.ValidationError(_("The two password fields didn't match."))

    return self.cleaned_data
share|improve this answer
add comment

Your Answer


