#26537: BaseInlineFormSet Adds N Entries to form._meta.fields For FK
-------------------------------+--------------------
Reporter: dsanders11 | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Currently `BaseInlineFormSet` appends the FK name for the formset to the
fields for the form `Meta` every time `add_fields` runs, so with you end
up with N fields where N - 1 are duplicates. As each form is instantiated
it'll see a different version of the list.
Example based on `tests/inline_formsets/tests.py`:
{{{
>>> poet = Poet.objects.create(name='test')
>>> poet.poem_set.create(name='first test poem')
>>> poet.poem_set.create(name='second test poem')
>>> poet.poem_set.create(name='third test poem')
>>> PoemFormSet = inlineformset_factory(Poet, Poem, fields=('name',),
extra=0)
>>> formset = PoemFormSet(None, instance=poet)
>>> PoemFormSet.form._meta.fields
['name', 'poet', 'poet', 'poet']
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26537>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.f2790e7e35c08c8dafe4f6ffd82e182d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.