Opened 7 years ago

Closed 5 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 7 years ago by Ramiro Morales

Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Luke Plant

Type: Bug

comment:3 Changed 7 years ago by Luke Plant

Severity: Normal

comment:4 Changed 6 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 Changed 6 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 Changed 5 years ago by Tim Graham

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

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

Resolution: fixed
Status: newclosed

In d3fd8a151231726adacb99bdbcd573f95ce32262:

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

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