Formsets: Misleading documentation
The example of the documentation at <http://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-initial-data-with-a-formset> is maybe not optimal to explain how the 'extra' and 'initial' parameters of a formset work together. It looks like the total number of forms is always extra + 1 (in fact, 'extra' somehow suggests the additional number of forms with respect to a standard, single form). Then, it looks like these forms are filled with the content of the dicts in the initial_list.
Even though the correct behaviour is described in the text, this is easily overread, since usually the examples are the best documentation ;-)
If you'd provide in the example for example 'extra=1' and then pass a list with two dicts as 'initial', I think the behaviour would be more obvious.
We were just struggling over an hour until we got it.
Change History
(6)
Triage Stage: |
Unreviewed → Accepted
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
I believe the extra parameter describes how many blank forms to show. #12515 describes the confusion in a slightly different way.