Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#17155 closed Bug (worksforme)

ModelForm.clean() return value not applied to instance when used in a modelformset

Reported by: anonymous Owned by: nobody
Component: Forms Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Define a form with a clean method that alters the values in self.cleaned_data before returning them. If you use the form in a modelformset, the values returned by form.clean are not applied to the model instance upon saving the formset (possibly related to #12960).

Attachments (1)

17155-test.diff (1.5 KB) - added by Claude Paroz 5 years ago.
Test custom clean with model formsets

Download all attachments as: .zip

Change History (3)

comment:1 Changed 5 years ago by Claude Paroz

Resolution: worksforme
Status: newclosed

Attached is a test that is currently passing. If you can make a test that fails, then please reopen the ticket.

Changed 5 years ago by Claude Paroz

Attachment: 17155-test.diff added

Test custom clean with model formsets

comment:2 Changed 5 years ago by anonymous

My sincere apologies for the time wasted. It helps to not put the field you're altering into the form's exclude.

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