#16995: ModelFormSet initial data from initial parameter uses "extra" forms -------------------------------+------------------------------------ Reporter: p910221@… | Owner: nobody Type: Bug | Status: new Component: Documentation | Version: SVN Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+------------------------------------ Changes (by carljm):
* needs_better_patch: => 0 * component: Forms => Documentation * needs_tests: => 0 * version: 1.3 => SVN * needs_docs: => 0 * stage: Unreviewed => Accepted Comment: I believe this is working as designed. I do, however, think the documentation is lacking in clarity and there's an inconsistency with how `initial` works in a regular `FormSet`. With a `FormSet`, `extra` forms are those beyond the ones created by the data in `initial`, as [https://docs.djangoproject.com/en/dev/topics/forms/formsets/#using- initial-data-with-a-formset documented here]. With a `ModelFormSet`, the data in the non-extra forms is determined by the existing model instances. It's sometimes useful to be able to pre- populate some of the extra forms with some initial data, and that's what the `initial` parameter is used for. If `initial` pre-populated the non- extra forms, how would the conflict with existing model instance data be resolved? If this were being designed from scratch, you could perhaps make a case that a `ModelFormSet` should consist of first the forms representing existing instances, then forms representing the given `initial` data, then empty `extra` forms (i.e. `initial` would add more forms, not prepopulate the `extra` forms). This would perhaps be more consistent with `FormSet`, but I'm not sure it's actually better for real usage. In any case, if it's an improvement at all, it's not enough of one to justify making a backwards-incompatible change. So I'm converting this into a documentation bug; the `ModelFormSet` [https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#model- formsets docs] should have an explanation of how `initial` and `extra` interact differently in a `ModelFormSet` than in a `FormSet`. -- Ticket URL: <https://code.djangoproject.com/ticket/16995#comment:1> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.