summaryrefslogtreecommitdiff
path: root/django/db/models/constraints.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/constraints.py')
-rw-r--r--django/db/models/constraints.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/django/db/models/constraints.py b/django/db/models/constraints.py
index e7f81d3ee9..fe0d42a168 100644
--- a/django/db/models/constraints.py
+++ b/django/db/models/constraints.py
@@ -54,11 +54,9 @@ class CheckConstraint(BaseConstraint):
return "<%s: check='%s' name=%r>" % (self.__class__.__name__, self.check, self.name)
def __eq__(self, other):
- return (
- isinstance(other, CheckConstraint) and
- self.name == other.name and
- self.check == other.check
- )
+ if isinstance(other, CheckConstraint):
+ return self.name == other.name and self.check == other.check
+ return super().__eq__(other)
def deconstruct(self):
path, args, kwargs = super().deconstruct()
@@ -106,12 +104,13 @@ class UniqueConstraint(BaseConstraint):
)
def __eq__(self, other):
- return (
- isinstance(other, UniqueConstraint) and
- self.name == other.name and
- self.fields == other.fields and
- self.condition == other.condition
- )
+ if isinstance(other, UniqueConstraint):
+ return (
+ self.name == other.name and
+ self.fields == other.fields and
+ self.condition == other.condition
+ )
+ return super().__eq__(other)
def deconstruct(self):
path, args, kwargs = super().deconstruct()