Opened 16 years ago

Last modified 16 years ago

#9284 closed

BaseModelFormSet and BaseInlineFormSet should call ModelForm.save() when saving objects — at Version 2

Reported by: drozzy@… Owned by: nobody
Component: Forms Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by jkocherhans)

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 (3)

comment:1 by Malcolm Tredinnick, 16 years ago

Resolution: invalid
Status: newclosed

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.

comment:2 by jkocherhans, 16 years ago

Description: modified (diff)
Has patch: set
Resolution: invalid
Status: closedreopened
Summary: Formsets don't call form's saveBaseModelFormSet and BaseInlineFormSet should call ModelForm.save() when saving objects
Triage Stage: UnreviewedDesign decision needed

by jkocherhans, 16 years ago

Attachment: 9284.diff added

Fixed a typo

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