#36668: ModelForm validation skips UniqueConstraint if its condition refers to a
field not present on the form
-------------------------------------+-------------------------------------
     Reporter:  Baptiste Mispelon    |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  5.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
  modelform,constraint,uniqueconstraint|  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 This was discussed on the forum extensively so
 [https://forum.djangoproject.com/t/fields-excluded-from-model-constraint-
 validation/37597/4 I'll drop a link here].

 The TL;DR is by design as `unique_together` has always worked this way (if
 a unique constraint refers to any excluded fields then it's not validated)
 so we followed the same approach for `Meta.constraints`.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36668#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 visit 
https://groups.google.com/d/msgid/django-updates/01070199ee01ffa0-e59d0f27-2e03-4ad5-83a3-4c4005ed24c4-000000%40eu-central-1.amazonses.com.

Reply via email to