diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-05-10 13:03:39 -0700 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-05-11 12:01:28 +0200 |
| commit | d6aff369ad33457ae2355b5b210faf1c4890ff35 (patch) | |
| tree | 4c9d43311078bd81098e8a9fe9ff89fe007e921e /django/db/models/sql | |
| parent | 23f6fbdd93cd668740e3a1cd6d8c8259f380c0fe (diff) | |
Refs #30116 -- Simplified regex match group access with Match.__getitem__().
The method has been available since Python 3.6. The shorter syntax is
also marginally faster.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/compiler.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 05597173ee..09a9d73077 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -383,7 +383,7 @@ class SQLCompiler: # not taken into account so we strip it. When this entire method # is refactored into expressions, then we can check each part as we # generate it. - without_ordering = self.ordering_parts.search(sql).group(1) + without_ordering = self.ordering_parts.search(sql)[1] params_hash = make_hashable(params) if (without_ordering, params_hash) in seen: continue @@ -396,7 +396,7 @@ class SQLCompiler: if self.query.distinct and not self.query.distinct_fields: select_sql = [t[1] for t in select] for expr, (sql, params, is_ref) in order_by: - without_ordering = self.ordering_parts.search(sql).group(1) + without_ordering = self.ordering_parts.search(sql)[1] if not is_ref and (without_ordering, params) not in select_sql: extra_select.append((expr, (without_ordering, params), None)) return extra_select |
