I'd like to use the following form class in a modelformset. It takes a maps parameter and customizes the form fields accordingly.
class MyModelForm(forms.ModelForm):
def __init__(self, maps, *args, **kwargs):
super(MyModelForm, self).__init__(*args, **kwargs)
#customize fields here
class Meta:
model = MyModel
My question is, how do I use this form in a modelformset? When I pass it using the form parameter like below, I get an exception.
MyFormSet = modelformset_factory(MyModel, form=MyModelForm(maps))
I suspect it wants the form class only, if so how do I pass the maps parameter to the form?