mirror of
https://github.com/django/django.git
synced 2025-10-27 23:56:08 +00:00
[3.2.x] Fixed #32717 -- Fixed filtering of querysets combined with the | operator.
Address a long standing bug in a Where.add optimization to discard equal nodes that was surfaced by implementing equality for Lookup instances inbbf141bcdc. Thanks Shaheed Haque for the report. Backport ofb81c7562fcfrom main
This commit is contained in:
committed by
Mariusz Felisiak
parent
d6b6eda4ed
commit
386caa5445
@@ -1338,6 +1338,10 @@ class Queries4Tests(TestCase):
|
||||
self.assertEqual(len(combined), 1)
|
||||
self.assertEqual(combined[0].name, 'a1')
|
||||
|
||||
def test_combine_or_filter_reuse(self):
|
||||
combined = Author.objects.filter(name='a1') | Author.objects.filter(name='a3')
|
||||
self.assertEqual(combined.get(name='a1'), self.a1)
|
||||
|
||||
def test_join_reuse_order(self):
|
||||
# Join aliases are reused in order. This shouldn't raise AssertionError
|
||||
# because change_map contains a circular reference (#26522).
|
||||
|
||||
Reference in New Issue
Block a user