summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorPaveł Tyślacki <pavel.tyslacki@gmail.com>2018-12-27 22:21:59 +0300
committerTim Graham <timograham@gmail.com>2019-01-12 09:50:20 -0500
commitb69f8eb04cc8762d3dfd5af5ea1fc58e3f2ebcc3 (patch)
tree6662b0cfe731e1912ff157ed46540be87cbec2bc /docs/ref
parent1e837c4b2351c83b1c902314ddfdfa15c63bc60d (diff)
Fixed #30062 -- Added support for unique conditional constraints.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/constraints.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/ref/models/constraints.txt b/docs/ref/models/constraints.txt
index c92d2dde37..acf3375b4a 100644
--- a/docs/ref/models/constraints.txt
+++ b/docs/ref/models/constraints.txt
@@ -69,3 +69,17 @@ date.
.. attribute:: UniqueConstraint.name
The name of the constraint.
+
+``condition``
+-------------
+
+.. attribute:: UniqueConstraint.condition
+
+A :class:`Q` object that specifies the condition you want the constraint to
+enforce.
+
+For example, ``UniqueConstraint(fields=['user'], condition=Q(status='DRAFT')``
+ensures that each user only has one draft.
+
+These conditions have the same database restrictions as
+:attr:`Index.condition`.