#12896: ModelForm.is_valid() and ModelForm.errors have backwards-incompatible
side
effects since model validation
---------------------------------------------+------------------------------
Reporter: lukeplant | Owner: jkocherhans
Status: assigned | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by jkocherhans):
* owner: nobody => jkocherhans
* status: new => assigned
Comment:
`Model.full_clean()` modifies the model in-place. I hope no one will argue
that's the wrong thing to do. So, to fix this I see a couple of solutions,
both of which I think are unacceptable.
1. Copy the instance. Copying could be an expensive operation, and if the
developer really wants to do that, they can just explicitly do it
themselves and pass the copy to the `ModeForm` constructor.
2. Change the internals of `Model.full_clean()` to optionally not modify
the model in place, and change `ModelForm` to use that option. I think
this option is just needlessly confusing.
I'll add a warning to the release notes and to the `ModelForm` docs.
--
Ticket URL: <http://code.djangoproject.com/ticket/12896#comment:5>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.