Opened 13 years ago

Closed 13 years ago

#15282 closed (invalid)

inlineformset_factory ignores overrides on base_fields when a form class is passed in

Reported by: coleifer Owned by: nobody
Component: Forms Version: 1.2
Severity: Keywords: inlineformset_factory, ModelFormMetaclass
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using inlineformset_factory with your own Form class, any overrides present in the base_fields do not carry over to the form of the generated formset.

Looking at http://code.djangoproject.com/browser/django/trunk/django/forms/models.py#L216 if a declared_field is overridden it will be updated correctly, but updates to base_fields do not.

My specific use-case: hooking into the admin inline's get_formset() method, I want to be able to alter the queryset of certain inline form fields on a per-request basis. Code here http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L1297

Attachments (2)

testcase.diff (1.6 KB ) - added by coleifer 13 years ago.
testcase indicating failure
patch.diff (751 bytes ) - added by coleifer 13 years ago.
Patch

Download all attachments as: .zip

Change History (4)

by coleifer, 13 years ago

Attachment: testcase.diff added

testcase indicating failure

by coleifer, 13 years ago

Attachment: patch.diff added

Patch

comment:1 by coleifer, 13 years ago

Has patch: set

comment:2 by anonymous, 13 years ago

Resolution: invalid
Status: newclosed

base_fields is not a public API, so this isn't a bug. Reopen if there's a manifestation of the issue that can be triggered without poking directly at base_fields.

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