summaryrefslogtreecommitdiff
path: root/tests/aggregation
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2019-03-11 22:48:54 -0400
committerTim Graham <timograham@gmail.com>2019-03-23 10:11:45 -0400
commit1ca825e4dc186da2b93292b5c848a3e5445968d7 (patch)
treef9ff8421040aecfb8d174c928e9a89bf044f84f1 /tests/aggregation
parent3f32154f40a855afa063095e3d091ce6be21f2c5 (diff)
Fixed #30246 -- Reused annotation aliases references in aggregation filters.
Thanks Jan BaryƂa for the detailed report and the reduced test case.
Diffstat (limited to 'tests/aggregation')
-rw-r--r--tests/aggregation/test_filter_argument.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/aggregation/test_filter_argument.py b/tests/aggregation/test_filter_argument.py
index 63dee59464..5848fc9a12 100644
--- a/tests/aggregation/test_filter_argument.py
+++ b/tests/aggregation/test_filter_argument.py
@@ -87,3 +87,11 @@ class FilteredAggregateTests(TestCase):
older_friends_count__gte=2,
)
self.assertEqual(qs.get(pk__in=qs.values('pk')), self.a1)
+
+ def test_filtered_aggregate_ref_annotation(self):
+ aggs = Author.objects.annotate(
+ double_age=F('age') * 2,
+ ).aggregate(
+ cnt=Count('pk', filter=Q(double_age__gt=100)),
+ )
+ self.assertEqual(aggs['cnt'], 2)