aggregate() - It is a terminal clause for a queryset that, when invoked, return dictionary name-value pair. Required Module: django.db.models import Avg, Min, Max, Sum, Count Open views.py file and write this code e.g. def home(request): stud_data=Student.objects.all(); average=stud_data.aggregate(average('marks')) total=stud_data.aggregate(Sum('marks')) minimum=stud_data.aggregate(Min('marks')) maximum=stud_data.aggregate(Max('marks')) totalCount=stud_data.aggregate(Count('marks')) context { 'students':stud_data,'average':average,'total':total,'minimum':minimum,'maximum':maximum,'totalCount':totalCount }