def inlineformset_factory(parent_model, model, form=ModelForm, formset=BaseInlineFormSet, fk_name=None, fields=None, exclude=None, extra=3, can_order=False, can_delete=True, max_num=None, formfield_callback=None):
 fk = _get_foreign_key(parent_model, model, fk_name=fk_name)
 if fk.unique:
  max_num = 1
 kwargs = {u'form': form, u'formfield_callback': formfield_callback, u'formset': formset, u'extra': extra, u'can_delete': can_delete, u'can_order': can_order, u'fields': fields, u'exclude': exclude, u'max_num': max_num}
 FormSet = modelformset_factory(model, **kwargs)
 FormSet.fk = fk
 return FormSet

def inlineformset_factory ( parent_model , model , form = ModelForm , formset = BaseInlineFormSet , fk_name = None , fields = None , exclude = None , extra = 3 , can_order = False , can_delete = True , max_num = None , formfield_callback = None ) : fk = _get_foreign_key ( parent_model , model , fk_name = fk_name ) if fk . unique : max_num = 1 kwargs = { u'form' : form , u'formfield_callback' : formfield_callback , u'formset' : formset , u'extra' : extra , u'can_delete' : can_delete , u'can_order' : can_order , u'fields' : fields , u'exclude' : exclude , u'max_num' : max_num } FormSet = modelformset_factory ( model , ** kwargs ) FormSet . fk = fk return FormSet
returns an inlineformset for the given kwargs .