def modelformset_factory(model, form=ModelForm, formfield_callback=None, formset=BaseModelFormSet, extra=1, can_delete=False, can_order=False, max_num=None, fields=None, exclude=None, widgets=None, validate_max=False, localized_fields=None, labels=None, help_texts=None, error_messages=None):
 meta = getattr(form, u'Meta', None)
 if (meta is None):
  meta = type(str(u'Meta'), (object,), {})
 if ((getattr(meta, u'fields', fields) is None) and (getattr(meta, u'exclude', exclude) is None)):
  warnings.warn(u"Calling modelformset_factory without defining 'fields' or 'exclude' explicitly is deprecated", PendingDeprecationWarning, stacklevel=2)
 form = modelform_factory(model, form=form, fields=fields, exclude=exclude, formfield_callback=formfield_callback, widgets=widgets, localized_fields=localized_fields, labels=labels, help_texts=help_texts, error_messages=error_messages)
 FormSet = formset_factory(form, formset, extra=extra, max_num=max_num, can_order=can_order, can_delete=can_delete, validate_max=validate_max)
 FormSet.model = model
 return FormSet

def modelformset_factory ( model , form = ModelForm , formfield_callback = None , formset = BaseModelFormSet , extra = 1 , can_delete = False , can_order = False , max_num = None , fields = None , exclude = None , widgets = None , validate_max = False , localized_fields = None , labels = None , help_texts = None , error_messages = None ) : meta = getattr ( form , u'Meta' , None ) if ( meta is None ) : meta = type ( str ( u'Meta' ) , ( object , ) , { } ) if ( ( getattr ( meta , u'fields' , fields ) is None ) and ( getattr ( meta , u'exclude' , exclude ) is None ) ) : warnings . warn ( u"Calling modelformset_factory without defining 'fields' or 'exclude' explicitly is deprecated" , PendingDeprecationWarning , stacklevel = 2 ) form = modelform_factory ( model , form = form , fields = fields , exclude = exclude , formfield_callback = formfield_callback , widgets = widgets , localized_fields = localized_fields , labels = labels , help_texts = help_texts , error_messages = error_messages ) FormSet = formset_factory ( form , formset , extra = extra , max_num = max_num , can_order = can_order , can_delete = can_delete , validate_max = validate_max ) FormSet . model = model return FormSet
returns a formset class for the given django model class .