I have a form which I want all other forms to inherit from, below is what I have tried but I'm getting an error what suggests the init is not running from the AbstractFormBase class. SchemeForm 'should' inherit all the __init__ arguments before running its own.
Error:
'SchemeForm' object has no attribute 'fields'
Code Updated:
class AbstractFormBase(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-3'
self.helper.field_class = 'col-lg-8'
class SchemeForm(AbstractFormBase, NgModelFormMixin,):
def __init__(self, *args, **kwargs):
super(SchemeForm, self).__init__(*args, **kwargs)
self.helper.layout = Layout(
'name',
'domain',
'slug',
)
fieldsor aexcludeattribute on the Meta object.AbstractFormBasedoesn't cooperate with any other classes in the inheritance structure.