summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorPeter DeVita <mewtwo2643@yahoo.com>2025-01-17 13:22:24 -0500
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-27 10:32:19 +0100
commit8eca4077f60fa0705ecfd9437c9ceaeef7a3808b (patch)
treec8f445e29bf269835d4ce15fbf305dcba00ecae1 /django/db/models/sql
parent9a71eca64bd3a357ef4846d81668d690089779c7 (diff)
Fixed #36109 -- Fixed RecursionError when stacking FilteredRelation joins.
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/query.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 6fbf854e67..ddf6c891fa 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1946,6 +1946,8 @@ class Query(BaseExpression):
reuse = can_reuse if join.m2m else None
alias = self.join(connection, reuse=reuse)
joins.append(alias)
+ if join.filtered_relation and can_reuse is not None:
+ can_reuse.add(alias)
return JoinInfo(final_field, targets, opts, joins, path, final_transformer)
def trim_joins(self, targets, joins, path):