class ReportForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.Meta.model = getattr(models, args[0])
self.Meta.exclude = ('pk', 'code')
super(ReportForm, self).__init__(*args, **kwargs)
for key in self.fields.keys():
self.fields[key].widget = forms.TextInput(attrs={'class': 'form-control'})
ReportForm('ReportOne')
ReportForm('ReportTwo')