Question : Average of total in django querysets
Answered by : happy-hamster-2cv6e5x8i52y
>>> from django.db.models import Avg
>>> Book.objects.all().aggregate(Avg('price'))
{'price__avg': 34.35}
Source : https://docs.djangoproject.com/en/4.0/topics/db/aggregation/ | Last Update : Wed, 23 Feb 22