Opened 4 years ago

Closed 4 years ago

Last modified 4 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 claudep 4 years ago.
Test custom clean with model formsets

Download all attachments as: .zip

Change History (3)

comment:1 Changed 4 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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

Changed 4 years ago by claudep

Test custom clean with model formsets

comment:2 Changed 4 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