1👍
✅
The product of the aggregate queryset is a a dictionary {'stars_avg': 2.75}
. Just like for any other Python dictionary, you can access its values in a Django template by using dot notation. In this case it would be: {{starsavg.stars_avg}}
.
Here are the docs on accessing values in templates using dot notation.
https://docs.djangoproject.com/en/1.10/ref/templates/api/#variables-and-lookups
Otherwise, if you want to deal with the value in your view code, you can access it like you would normal Python dictionary in Python: starsavg['stars_avg']
.
Source:stackexchange.com