diff options
| author | Simon Charette <charette.s@gmail.com> | 2026-03-15 23:31:18 -0400 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-03-19 12:24:17 -0400 |
| commit | 1786cd881ff4ad9458d56180ae555d92c14e5af8 (patch) | |
| tree | 6eb2661f3648b6645336cd6e5eb66989f9d2c6b1 /django | |
| parent | 5146449a38222dc74f8f1ba88a7a7ef681e93101 (diff) | |
Refs #36795 -- Deprecated SQLCompiler.quote_name_unless_alias().
It has been superseded with .quote_name(), which ensures aliases are
always quoted.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/sql/compiler.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index f52ca515f2..bcf28f9ae1 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -1,6 +1,7 @@ import collections import json import re +import warnings from functools import partial from itertools import chain @@ -23,6 +24,7 @@ from django.db.models.sql.constants import ( ) from django.db.models.sql.query import Query, get_order_dir from django.db.transaction import TransactionManagementError +from django.utils.deprecation import RemovedInDjango70Warning, django_file_prefixes from django.utils.functional import cached_property from django.utils.hashable import make_hashable from django.utils.regex_helper import _lazy_re_compile @@ -556,8 +558,17 @@ class SQLCompiler: self.quote_cache[name] = quoted return quoted - # Kept for backward compatiblity until duly done deprecation. - quote_name_unless_alias = quote_name + # RemovedInDjango70Warning: When the deprecation ends, remove. + def quote_name_unless_alias(self, name): + warnings.warn( + ( + "SQLCompiler.quote_name_unless_alias() is deprecated. " + "Use .quote_name() instead." + ), + category=RemovedInDjango70Warning, + skip_file_prefixes=django_file_prefixes(), + ) + return self.quote_name(name) def compile(self, node): vendor_impl = getattr(node, "as_" + self.connection.vendor, None) |
