Aggregation computes values over sets of rows with aggregate() (one global value) and annotate() (one value per object), with functions like Count, Sum, Avg, Max. values() before annotate() produces a grouping, the equivalent of GROUP BY in SQL.
Example
Article.objects.aggregate(total=Count('id'))