|
10 | 10 | import copy |
11 | 11 | import difflib |
12 | 12 | import functools |
13 | | -import inspect |
14 | 13 | import sys |
15 | 14 | import warnings |
16 | 15 | from collections import Counter, namedtuple |
|
44 | 43 | from django.db.models.sql.constants import INNER, LOUTER, ORDER_DIR, SINGLE |
45 | 44 | from django.db.models.sql.datastructures import BaseTable, Empty, Join, MultiJoin |
46 | 45 | from django.db.models.sql.where import AND, OR, ExtraWhere, NothingNode, WhereNode |
47 | | -from django.utils.deprecation import RemovedInDjango70Warning |
| 46 | +from django.utils.deprecation import RemovedInDjango70Warning, django_file_prefixes |
48 | 47 | from django.utils.functional import cached_property |
49 | 48 | from django.utils.regex_helper import _lazy_re_compile |
50 | 49 | from django.utils.tree import Node |
@@ -1216,15 +1215,10 @@ def join_parent_model(self, opts, model, alias, seen): |
1216 | 1215 | def check_alias(self, alias): |
1217 | 1216 | # RemovedInDjango70Warning: When the deprecation ends, remove. |
1218 | 1217 | if "%" in alias: |
1219 | | - if "aggregate" in {frame.function for frame in inspect.stack()}: |
1220 | | - stacklevel = 5 |
1221 | | - else: |
1222 | | - # annotate(), alias(), and values(). |
1223 | | - stacklevel = 6 |
1224 | 1218 | warnings.warn( |
1225 | 1219 | "Using percent signs in a column alias is deprecated.", |
1226 | | - stacklevel=stacklevel, |
1227 | 1220 | category=RemovedInDjango70Warning, |
| 1221 | + skip_file_prefixes=django_file_prefixes(), |
1228 | 1222 | ) |
1229 | 1223 | if FORBIDDEN_ALIAS_PATTERN.search(alias): |
1230 | 1224 | raise ValueError( |
|
0 commit comments