Ticket #5759: inline_formset_form_kwarg.diff

File inline_formset_form_kwarg.diff, 1.2 KB (added by Antti Kaihola, 17 years ago)

simple patch to provide this functionality

  • django/newforms/models.py

     
    338338            raise Exception("%s has more than 1 ForeignKey to %s" % (model, parent_model))
    339339    return fk
    340340
    341 def inline_formset(parent_model, model, fk_name=None, fields=None, extra=3, orderable=False, deletable=True, formfield_callback=lambda f: f.formfield()):
     341def inline_formset(parent_model, model, form=BaseForm, fk_name=None, fields=None, extra=3, orderable=False, deletable=True, formfield_callback=lambda f: f.formfield()):
    342342    """
    343343    Returns an ``InlineFormset`` for the given kwargs.
    344344
     
    347347    """
    348348    fk = get_foreign_key(parent_model, model, fk_name=fk_name)
    349349    # let the formset handle object deletion by default
    350     FormSet = formset_for_model(model, formset=InlineFormset, fields=fields,
     350    FormSet = formset_for_model(model, form=form, formset=InlineFormset, fields=fields,
    351351                                formfield_callback=formfield_callback,
    352352                                extra=extra, orderable=orderable,
    353353                                deletable=deletable)
Back to Top