summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorDavid Wobrock <david.wobrock@gmail.com>2022-05-17 11:32:30 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-05-19 07:52:44 +0200
commit820b4e565a06eddacf9a8038dd7b83784c6e99da (patch)
treea39c737aa53bc670e0efd593c02cc420f9b19e2b /django
parentaa3197e5f11f33aef22f4d5a1fe711501bfbc49c (diff)
[4.1.x] Fixed #33705 -- Fixed crash when using IsNull() lookup in filters.
Thanks Florian Apolloner for the report. Thanks Simon Charette for the review. Backport of 9f5548952906c6ea97200c016734b4f519520a64 from main
Diffstat (limited to 'django')
-rw-r--r--django/db/models/lookups.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py
index 5db549e6bf..866e38df83 100644
--- a/django/db/models/lookups.py
+++ b/django/db/models/lookups.py
@@ -171,9 +171,10 @@ class Lookup(Expression):
c.lhs = self.lhs.resolve_expression(
query, allow_joins, reuse, summarize, for_save
)
- c.rhs = self.rhs.resolve_expression(
- query, allow_joins, reuse, summarize, for_save
- )
+ if hasattr(self.rhs, "resolve_expression"):
+ c.rhs = self.rhs.resolve_expression(
+ query, allow_joins, reuse, summarize, for_save
+ )
return c
def select_format(self, compiler, sql, params):