Refs #30547 -- Clarified that partial UniqueConstraints don't affect model validation.

This commit is contained in:
Mariusz Felisiak 2019-07-18 12:56:25 +02:00 committed by GitHub
parent a3417282ac
commit 230d75f59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -35,11 +35,12 @@ option.
In general constraints are **not** checked during ``full_clean()``, and do In general constraints are **not** checked during ``full_clean()``, and do
not raise ``ValidationError``\s. Rather you'll get a database integrity not raise ``ValidationError``\s. Rather you'll get a database integrity
error on ``save()``. ``UniqueConstraint``\s are different in this regard, error on ``save()``. ``UniqueConstraint``\s without a
in that they leverage the existing ``validate_unique()`` logic, and thus :attr:`~UniqueConstraint.condition` (i.e. non-partial unique constraints)
enable two-stage validation. In addition to ``IntegrityError`` on are different in this regard, in that they leverage the existing
``save()``, ``ValidationError`` is also raised during model validation when ``validate_unique()`` logic, and thus enable two-stage validation. In
the ``UniqueConstraint`` is violated. addition to ``IntegrityError`` on ``save()``, ``ValidationError`` is also
raised during model validation when the ``UniqueConstraint`` is violated.
``CheckConstraint`` ``CheckConstraint``
=================== ===================