#35367: Multi-field constraint are not correctly handled when a form has one
field
marked as read-only
------------------------+--------------------------------------
Reporter: David | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+--------------------------------------
Changes (by David Sanders):
* resolution: => wontfix
* status: new => closed
Comment:
Form & model validation are separate concerns though & I'd argue this is
desired behaviour. In fact the code explicitly leaves out the constraint
validation because it includes field_1.
If you want the constraint to be respected then you'd need to add an
additional line to validate the model instance in its entirety:
{{{
if form.is_valid():
instance = form.save(commit=False)
instance.full_clean() # full_clean() within form.is_valid() excludes
field_1
instance.save()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35367#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018ec7c0b51a-acfa0ecb-5df9-4784-a2f2-0bc8d3243bae-000000%40eu-central-1.amazonses.com.