Opened 4 years ago

Closed 3 years ago

#15591 closed Bug (fixed)

ModelForm save() behavior contradicts with Model object validation documentation.

Reported by: vinod@… Owned by: nobody
Component: Documentation Version: 1.2
Severity: Normal Keywords: modelform validation save model object
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The documentation at that:
"Note that full_clean() will not be called automatically when you call your model’s save() method, nor as a result of ModelForm validation."

However, this is contradicted by the documentation at that states that:
"Note that save() will raise a ValueError if the data in the form doesn't validate -- i.e., if form.errors evaluates to True."

It appears that save() shouldn't check validation. That's what is_valid() does, throwing a ValidationError if necessary.

Change History (7)

comment:1 Changed 4 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by lukeplant

  • Type set to Bug

comment:3 Changed 4 years ago by lukeplant

  • Severity set to Normal

comment:4 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:5 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:6 Changed 3 years ago by timo

Actually the docs are correct, but I'll add some clarifying text.

comment:7 Changed 3 years ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In d3fd8a151231726adacb99bdbcd573f95ce32262:

Fixed #15591 - Clarified interaction between ModelForm and model validation.

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