| 8 | | @@ -1686,20 +1686,6 @@ def get_source_expressions(self): |
| | 7 | @@ -1605,20 +1605,6 @@ def get_source_fields(self): |
| | 8 | # We're only interested in the fields of the result expressions. |
| | 9 | return [self.result._output_field_or_none] |
| | 10 | |
| | 11 | - def resolve_expression( |
| | 12 | - self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False |
| | 13 | - ): |
| | 14 | - c = self.copy() |
| | 15 | - c.is_summary = summarize |
| | 16 | - if hasattr(c.condition, "resolve_expression"): |
| | 17 | - c.condition = c.condition.resolve_expression( |
| | 18 | - query, allow_joins, reuse, summarize, False |
| | 19 | - ) |
| | 20 | - c.result = c.result.resolve_expression( |
| | 21 | - query, allow_joins, reuse, summarize, for_save |
| | 22 | - ) |
| | 23 | - return c |
| | 24 | - |
| | 25 | def as_sql(self, compiler, connection, template=None, **extra_context): |
| | 26 | connection.ops.check_expression_support(self) |
| | 27 | template_params = extra_context |
| | 28 | @@ -1686,20 +1672,6 @@ def get_source_expressions(self): |
| | 50 | |
| | 51 | The only other change I would include is adjusting `BaseExpression.resolve_expression` to avoid calling `source_expression.__bool__` as that could result in the evaluation of `QuerySet` which could cause queries |
| | 52 | |
| | 53 | {{{#!diff |
| | 54 | diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py |
| | 55 | index 2494ec4139..0bb8332d45 100644 |
| | 56 | --- a/django/db/models/expressions.py |
| | 57 | +++ b/django/db/models/expressions.py |
| | 58 | @@ -296,7 +296,7 @@ def resolve_expression( |
| | 59 | [ |
| | 60 | ( |
| | 61 | expr.resolve_expression(query, allow_joins, reuse, summarize) |
| | 62 | - if expr |
| | 63 | + if expr is not None |
| | 64 | else None |
| | 65 | ) |
| | 66 | for expr in c.get_source_expressions() |
| | 67 | }}} |