1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35099 -- Prevented mutating queryset when combining with & and | operators.

Thanks Alan for the report.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
Hisham Mahmood
2024-02-06 19:40:01 +05:00
committed by Mariusz Felisiak
parent 6ee37ada32
commit d79fba7d8e
2 changed files with 19 additions and 0 deletions

View File

@@ -696,6 +696,7 @@ class Query(BaseExpression):
# except if the alias is the base table since it must be present in the
# query on both sides.
initial_alias = self.get_initial_alias()
rhs = rhs.clone()
rhs.bump_prefix(self, exclude={initial_alias})
# Work out how to relabel the rhs aliases, if necessary.