From 15cb3c262a7df568bb5c0e3e07d5078c08ef59f4 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Fri, 17 Nov 2023 20:40:31 -0500 Subject: Refs #34975 -- Complemented rhs filtering aggregations for __in lookup. While this isn't a regression it's clear that similar logic should be applied when dealing with lists of expressions passed as a lookup value. --- tests/aggregation/tests.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/aggregation') diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index af6c660cf1..b01df88109 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -2315,3 +2315,9 @@ class AggregateAnnotationPruningTests(TestCase): max_book_author=Max("book__authors"), ).aggregate(count=Count("id", filter=Q(id=F("max_book_author")))) self.assertEqual(aggregates, {"count": 1}) + + def test_aggregate_reference_lookup_rhs_iter(self): + aggregates = Author.objects.annotate( + max_book_author=Max("book__authors"), + ).aggregate(count=Count("id", filter=Q(id__in=[F("max_book_author"), 0]))) + self.assertEqual(aggregates, {"count": 1}) -- cgit v1.3