我正在尝试将django-registration与django-math-captcha集成,但我遇到了麻烦。我按照示例数学验证码的github。如果我使用MathCaptchaModelForm或MathCaptchaForm将registration.forms.RegistrationForm子类化,我会得到不同的错误
我的代码和相应的错误
class RegistrationForm(forms.Form, MathCaptchaModelForm)
Error: Error when calling the metaclass bases metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
or
class RegistrationForm(forms.Form, MathCaptchaForm) Error:Error when calling the metaclass bases. Cannot create a
一致的方法解析顺序 (MRO)基础表格,MathCaptchaForm
感谢您的帮助!
答案 0 :(得分:1)
只需扩展MatchCaptchaModelForm,因为它已经扩展了forms.ModelForm。