Opened 16 years ago

Closed 16 years ago

#9171 closed (fixed)

must pass `list` not `tuple` as `exclude` (as seen in docs) to `inlineformset_factory`.

Reported by: Tai Lee Owned by: nobody
Component: Forms Version: dev
Severity: Keywords: inlineformset_factory exclude
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If the exclude argument is not None but is also not list an exception will be raised as we try to append the foreign key field. Patch simply calls list() on exclude to allow any iterable to be passed in, similar to ChoiceField._set_choices.

Attachments (2)

9171-inlineformset_factory-r9082.diff (876 bytes ) - added by Tai Lee 16 years ago.
Added regression test that fails before and passes after patch is applied.
9171-inlineformset_factory-r9082.2.diff (2.2 KB ) - added by Tai Lee 16 years ago.
Also fix ModelAdmin and InlineModelAdmin to allow a tuple for exclude.

Download all attachments as: .zip

Change History (4)

by Tai Lee, 16 years ago

Added regression test that fails before and passes after patch is applied.

comment:1 by Brian Rosner, 16 years ago

Triage Stage: UnreviewedAccepted

by Tai Lee, 16 years ago

Also fix ModelAdmin and InlineModelAdmin to allow a tuple for exclude.

comment:2 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [9086]) Fixed #9171 -- Fixed a few places where we were assuming lists instead of
generic sequences in ModelForm structures. Patch from mrmachine.

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