2👍
✅
Python always tries to find methods via the MRO, which is based on the order the parent classes are declared. So in this case since you put ModelForm
first in the class definition, it will find the __init__
there first, hence the error.
The solution is just to swap the order:
class InheritedForm(ParentForm, forms.ModelForm):
although I do wonder why you’ve declared ParentForm as inheriting from forms.Form in the first place – might as well make it inherit from ModelForm, then you don’t need the multiple inheritance in InheritedForm.
Source:stackexchange.com