Well, the docs as of today on aggregation don’t mention anything about the specific types of Aggregation possible. It mentions Avg, Min, Count, etc.
Update from Derek below: actually, it’s in the docs in the Queryset API docs under “Aggregation Functions”
http://docs.djangoproject.com/en/dev/ref/models/querysets/#sum
Missed that… but there should be a link back there from the main aggregation docs.
Anyhoo, I found another type Sum in django.db.models.
Just apply
MyQueryset.aggregate(Sum('my_field')) to get the sum of all my_fields in your queryset.
Actually, I think the docs have always described this:
http://docs.djangoproject.com/en/dev/ref/models/querysets/#sum
Ahh you are right. It just wasn’t in the aggregation docs. Oops!
Yup. Always check the full API docs!
Roger that!
thanks useful to me