问题描述
||
我正在尝试将django注册与django-math-captcha集成在一起,但是我遇到了麻烦。我遵循了数学验证码的github示例。如果我将Math.CaptchaModelForm或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
谢谢你的帮助!
解决方法
只需扩展MatchCaptchaModelForm,因为它已经扩展了form.ModelForm。