#30547: Specify what happens during model validation with Meta.constraints
-------------------------------------+-------------------------------------
               Reporter:  Dirk       |          Owner:  nobody
  Groten                             |
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:             |        Version:  2.2
  Documentation                      |       Keywords:  constraints,
               Severity:  Normal     |  UniqueConstraint
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 The current [https://docs.djangoproject.com/en/2.2/ref/models/constraints/
 constraints reference] does not mention whether or not a
 **ValidationError** is raised during model validation if a constraint
 fails. The documentation only mentions that a database constraint is
 created.

 However, for the soon to be deprecated `unique_together`, there is a
 reference to model validation.

 As far as I can see, a `UniqueConstraint` causes `validate_unique()` to
 check for uniqueness and raises a **ValidationError**. But a
 `CheckConstraint` does not cause a **ValidationError** when the model is
 validated. I believe it's important to mention this in the documentation.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30547>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.96bad640084b74042605819a9c22ffdb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to