summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes@5monkeys.se>2020-06-29 06:41:23 +0200
committerGitHub <noreply@github.com>2020-06-29 06:41:23 +0200
commit30e3d2d78df01d5e89e8a9491f5f061dda239fe5 (patch)
tree6262ea7e260bce213626d5da98edcb34a0c919f2 /django
parent62d85a283500e9abb0e1c9ec53c59be468f056a0 (diff)
Fixed #31745 -- Added error messages when using UniqueConstraint.include/opclasses with deferrable.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/constraints.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/django/db/models/constraints.py b/django/db/models/constraints.py
index c6dd39e762..fd01ec5a11 100644
--- a/django/db/models/constraints.py
+++ b/django/db/models/constraints.py
@@ -95,6 +95,14 @@ class UniqueConstraint(BaseConstraint):
raise ValueError(
'UniqueConstraint with conditions cannot be deferred.'
)
+ if include and deferrable:
+ raise ValueError(
+ 'UniqueConstraint with include fields cannot be deferred.'
+ )
+ if opclasses and deferrable:
+ raise ValueError(
+ 'UniqueConstraint with opclasses cannot be deferred.'
+ )
if not isinstance(deferrable, (type(None), Deferrable)):
raise ValueError(
'UniqueConstraint.deferrable must be a Deferrable instance.'