Hi folks,
I'm trying to compute the average of a field over various subsets of a queryset.
Player.objects.order_by('-score').filter(sex='male').aggregate(Avg('level'))
This works perfectly!
But... if I try to compute it for the top 50 players it does not work.
Player.objects.order_by('-score').filter(sex='male')[:50].aggregate(Avg('level'))
This last one returns the exact same result as the query above it, which is wrong.
What am I doing wrong?
Help would be very much appreciated!