BaseModelFormSet and BaseInlineFormSet should call ModelForm.save() when saving objects
The most current code is at http://github.com/jkocherhans/django/tree/formset-updates
This introduces some backwards incompatibilities for people who overrode either type of formset's __init__
method, but this is how I would have written the model formset code if we'd actually had modelforms first. This doesn't really solve any specific problems that I know of.
Change History
(5)
Resolution: |
→ invalid
|
Status: |
new → closed
|
Description: |
modified (diff)
|
Has patch: |
set
|
Resolution: |
invalid
|
Status: |
closed → reopened
|
Summary: |
Formsets don't call form's save → BaseModelFormSet and BaseInlineFormSet should call ModelForm.save() when saving objects
|
Triage Stage: |
Unreviewed → Design decision needed
|
Resolution: |
→ fixed
|
Status: |
reopened → closed
|
Child forms don't always have enough information to save themselves in the situation when you're adding related elements to some other model: the related elements need to know which related model id to use, for example. If you look at the logic in model formsets (and you're only talking about model formsets here, since normal formsets don't have a
save()
method), you'll see that there's quite a bit of interaction between information that exists only on the formset object and the forms itself.If you can come up with some patch that works in all cases and is obviously neater than the current code, then reopen the ticket, but this is currently a bit too ill-defined to be a ticket we can resolve.