summaryrefslogtreecommitdiff
path: root/django/db/models/constraints.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-07-12 11:46:37 +0200
committerGitHub <noreply@github.com>2021-07-12 11:46:37 +0200
commit0250340e372f652c4f276e6874d452d683c94dfe (patch)
treef9b88bd86c2d5e3c03805577f6413c7300f648c0 /django/db/models/constraints.py
parent013a1824d3c57b7ffc5240bc03d219a4a290aa3d (diff)
downloaddjango-0250340e372f652c4f276e6874d452d683c94dfe.tar.gz
Refs #32074 -- Used Enum.repr() format proposed for Python 3.10.
The Python's Steering Council decided to revert changes in the Enum module (see https://bugs.python.org/issue44559) and moved them to Python 3.11. Follow up to 5d9b065d3f93de056588dfee6f1776294dd8bab2. Thanks Nick Pope for the review.
Diffstat (limited to 'django/db/models/constraints.py')
-rw-r--r--django/db/models/constraints.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/django/db/models/constraints.py b/django/db/models/constraints.py
index 8ae05a504c..d36d076346 100644
--- a/django/db/models/constraints.py
+++ b/django/db/models/constraints.py
@@ -4,7 +4,6 @@ from django.db.models.expressions import ExpressionList, F
from django.db.models.indexes import IndexExpression
from django.db.models.query_utils import Q
from django.db.models.sql.query import Query
-from django.utils.version import PY310
__all__ = ['CheckConstraint', 'Deferrable', 'UniqueConstraint']
@@ -86,10 +85,9 @@ class Deferrable(Enum):
DEFERRED = 'deferred'
IMMEDIATE = 'immediate'
- # A similar format is used in Python 3.10+.
- if not PY310:
- def __repr__(self):
- return '%s.%s' % (self.__class__.__qualname__, self._name_)
+ # A similar format was proposed for Python 3.10.
+ def __repr__(self):
+ return f'{self.__class__.__qualname__}.{self._name_}'
class UniqueConstraint(BaseConstraint):