#NEWLINE# def generic_inlineformset_factory( model , form = ModelForm , formset = BaseGenericInlineFormSet , ct_field = 'content_type' , fk_field = 'object_id' , fields = None , exclude = None , extra = 3 , can_order = False , can_delete = True , max_num = None , formfield_callback = None , validate_max = False , for_concrete_model = True , min_num = None , validate_min = False ) : #NEWLINE# #INDENT# '\n    Returns a ``GenericInlineFormSet`` for the given kwargs.\n\n    You must provide ``ct_field`` and ``fk_field`` if they are different from\n    the defaults ``content_type`` and ``object_id`` respectively.\n    ' #NEWLINE# opts = model . _meta #NEWLINE# ct_field = opts . get_field ( ct_field ) #NEWLINE# if ( ( not isinstance ( ct_field , models . ForeignKey ) ) or ( ct_field . remote_field . model != ContentType ) ) : #NEWLINE# #INDENT# raise Exception ( ( "fk_name '%s' is not a ForeignKey to ContentType" % ct_field ) ) #NEWLINE# #UNINDENT# fk_field = opts . get_field ( fk_field ) #NEWLINE# if ( exclude is not None ) : #NEWLINE# #INDENT# exclude = list ( exclude ) #NEWLINE# exclude . extend ( [ ct_field . name , fk_field . name ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# exclude = [ ct_field . name , fk_field . name ] #NEWLINE# #UNINDENT# FormSet = modelformset_factory ( model , form = form , formfield_callback = formfield_callback , formset = formset , extra = extra , can_delete = can_delete , can_order = can_order , fields = fields , exclude = exclude , max_num = max_num , validate_max = validate_max , min_num = min_num , validate_min = validate_min ) #NEWLINE# FormSet . ct_field = ct_field #NEWLINE# FormSet . ct_fk_field = fk_field #NEWLINE# FormSet . for_concrete_model = for_concrete_model #NEWLINE# return FormSet