Opened 12 years ago

Closed 12 years ago

#19569 closed New feature (duplicate)

Add "widgets" argument to function's modelformset_factory inputs

Reported by: Agris Ameriks Owned by: Nick Sandford
Component: Forms Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Function modelformset_factory doesn't have widgets=None in it's input arguments, but function modelform_factory (which is called from def modelformset_factory) widgets is defined as optional input argument.

As the fix is in 2 lines, then I included it in the description.

So the fix would be:

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):
    """
    Returns a FormSet class for the given Django model class.
    """
    form = modelform_factory(model, form=form, fields=fields, exclude=exclude,
                             formfield_callback=formfield_callback, widgets=widgets)
    FormSet = formset_factory(form, formset, extra=extra, max_num=max_num,
                              can_order=can_order, can_delete=can_delete)
    FormSet.model = model
    return FormSet

Change History (6)

comment:1 by Anssi Kääriäinen, 12 years ago

Needs documentation: set
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Seems like a good addition to me. This likely needs docs changes. And, we want a simple test, too...

comment:2 by Nick Sandford, 12 years ago

Easy pickings: unset
Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to Nick Sandford
Patch needs improvement: unset
Status: newassigned

comment:3 by Nick Sandford, 12 years ago

Added a pull request with tests and documentation fixes.

comment:4 by Claude Paroz, 12 years ago

Should we guess the pull request location?

comment:6 by Claude Paroz, 12 years ago

Resolution: duplicate
Status: assignedclosed

Seems a duplicate of #17416.

Note: See TracTickets for help on using tickets.
Back to Top