def modelform_factory(model, form=ModelForm, fields=None, exclude=None, formfield_callback=None, widgets=None):
 attrs = {u'model': model}
 if (fields is not None):
  attrs[u'fields'] = fields
 if (exclude is not None):
  attrs[u'exclude'] = exclude
 if (widgets is not None):
  attrs[u'widgets'] = widgets
 parent = (object,)
 if hasattr(form, u'Meta'):
  parent = (form.Meta, object)
 Meta = type(str(u'Meta'), parent, attrs)
 class_name = (model.__name__ + str(u'Form'))
 form_class_attrs = {u'Meta': Meta, u'formfield_callback': formfield_callback}
 return type(form)(class_name, (form,), form_class_attrs)

def modelform_factory ( model , form = ModelForm , fields = None , exclude = None , formfield_callback = None , widgets = None ) : attrs = { u'model' : model } if ( fields is not None ) : attrs [ u'fields' ] = fields if ( exclude is not None ) : attrs [ u'exclude' ] = exclude if ( widgets is not None ) : attrs [ u'widgets' ] = widgets parent = ( object , ) if hasattr ( form , u'Meta' ) : parent = ( form . Meta , object ) Meta = type ( str ( u'Meta' ) , parent , attrs ) class_name = ( model . __name__ + str ( u'Form' ) ) form_class_attrs = { u'Meta' : Meta , u'formfield_callback' : formfield_callback } return type ( form ) ( class_name , ( form , ) , form_class_attrs )
returns a modelform containing form fields for the given model .