def SiteAdminForm(model_cls, *args, **kwargs):
class MerchantAdminForm(forms.ModelForm):
class Meta:
exclude = ('external_links', 'published', 'logo','image_zip_file',)
model = model_cls
def __init__(self, *args, **kwargs):
super(MerchantAdminForm, self).__init__(*args, **kwargs)
return MerchantAdminForm()
# In use...
merchant_form = SiteAdminForm(merchant.__class__, instance=merchant)
No matter what is passed into model_cls
, model is always ignored.
Meta.exclude
is set properly, how can I dynamically update the Meta.model
?