Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#13010 closed (duplicate)

ModelForm clean() is ignored

Reported by: Patryk Zawadzki Owned by: nobody
Component: Forms Version: 1.2-beta
Severity: 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

In 1.2 when you validate a form the logic is as follows:

  • BaseForm's full_clean() is called
  • ModelForm's _clean_fields() is called
    • it calls each field's clean_FOO()
    • it calls construct_instance and at this point assigns all values to the instance
  • BaseForm's _clean_form() is called
    • it calls clean()

At this point clean() can update self.cleaned_data but the value is never used for anything. This breaks forms that rely on clean() being able to alter the data (useful for example when a field's value depends on other fields). The instance should at least be updated when calling save().

Change History (2)

comment:1 by jkocherhans, 15 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #12960.

comment:2 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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