Aggregation support was added to django's ORM in version 1.1, allowing you to generate Sums, Counts, and more without having to write any SQL. According to the docs aggregation is not supported for generic relations. This entry describes how to work around this using the .extra() method.
Entries tagged with "aggregation"
Generating aggregate data across generic relations
Django aggregation and most popular tags
Use Django to calculate most popular tags, or any query that makes use of an aggregation function.