Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#10750 closed (fixed)

BaseInlineFormSet does not respect commit=False in save for new objects after r10190

Reported by: Koen Biermans <koen.biermans@…> Owned by: jkocherhans
Component: Forms Version: dev
Severity: Keywords: formsets
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The save_new method on BaseInlineFormSet does not respect the commit bit passed to it (it saves the object even if commit=False). This method was added in r10190.

This means that if there are required fields that the forms on the inlineformset do not contain, you get an error, even if you use commit=False to add the required information to the new objects yourself.

Possible fix: do not do obj.save() if commit is False (line 549 in django/forms/models.py).

Attachments (2)

10750_baseinlineformset_savenew.diff (2.2 KB ) - added by Koen Biermans <koen.biermans@…> 16 years ago.
fix and test for baseinlineformset save not respecting commit=False
10750_baseinlineformset_savenew.2.diff (2.2 KB ) - added by Koen Biermans <koen.biermans@…> 16 years ago.
new try, replace messed up diff

Download all attachments as: .zip

Change History (7)

by Koen Biermans <koen.biermans@…>, 16 years ago

fix and test for baseinlineformset save not respecting commit=False

by Koen Biermans <koen.biermans@…>, 16 years ago

new try, replace messed up diff

comment:1 by jkocherhans, 16 years ago

Has patch: set
Owner: changed from nobody to jkocherhans
Status: newassigned
Triage Stage: UnreviewedAccepted

Thanks for adding a test case. I'll put this on my review list for 1.1.

comment:2 by Thejaswi Puthraya, 16 years ago

Component: UncategorizedForms

comment:3 by Jacob, 16 years ago

milestone: 1.1

comment:4 by Jacob, 16 years ago

Resolution: fixed
Status: assignedclosed

(In [10706]) Fixed #10750: respect comment=False in inline formsets. Thanks, Koen Biermans.

comment:5 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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