2011-04-13 21 views
0

我試圖將django註冊與django-math-captcha,但我遇到了麻煩。我跟着數學驗證碼的github的例子。如果我繼承registration.forms.RegistrationForm與MathCaptchaModelForm或MathCaptchaForm我得到不同的錯誤Django註冊和數學驗證碼不是很好玩

我的代碼和基地的形式,MathCaptchaForm各自的錯誤

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)

感謝您的幫助!

回答

1

只需擴展MatchCaptchaModelForm,因爲它已經擴展了forms.ModelForm。

+0

aahhh當然!因爲MathCaptchaForm已經擴展了forms.Form!謝謝! – rabbid 2011-04-13 14:30:35

+0

不客氣。您還可以提供一個Meta類,用於擴展您在進行多重繼承時繼承的模型之一:class Meta(InheritedModel.Meta): – Brandon 2011-04-13 14:33:58