summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwat009 <swatantra.kumar8@gmail.com>2019-06-20 14:14:02 +0530
committerCarlton Gibson <carlton.gibson@noumenal.es>2019-06-20 10:45:20 +0200
commitc3a0f76d11f8cb282798770152c875ba49445481 (patch)
tree00121c97505c7ca3296e6c64cf653a9d846f8c13
parentc3a9d3050ccfb2b685a4a37d4028b6bc5ca5565e (diff)
[2.2.x] Fixed #30547 -- Doc'd how Meta.constraints affect model validation.
Backport of 00169bc36156d4a32546229bf39de91213709eaf from master
-rw-r--r--docs/ref/models/constraints.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/ref/models/constraints.txt b/docs/ref/models/constraints.txt
index 6d24f43f67..aaadc78ee9 100644
--- a/docs/ref/models/constraints.txt
+++ b/docs/ref/models/constraints.txt
@@ -28,6 +28,16 @@ option.
(including ``name``) each time. Instead, specify the ``constraints`` option
on subclasses directly, providing a unique name for each constraint.
+.. admonition:: Validation of Constraints
+
+ In general constraints are **not** checked during ``full_clean()``, and do
+ not raise ``ValidationError``\s. Rather you'll get a database integrity
+ error on ``save()``. ``UniqueConstraint``\s are different in this regard,
+ in that they leverage the existing ``validate_unique()`` logic, and thus
+ enable two-stage validation. In addition to ``IntegrityError`` on
+ ``save()``, ``ValidationError`` is also raised during model validation when
+ the ``UniqueConstraint`` is violated.
+
``CheckConstraint``
===================