I am trying to execute the django aggregation function, but cannot get the desired result.
What I have:
income_posts.values_list('category__name','amount') [(u'Donation', Decimal("2000.00")), (u'Paycheck', Decimal("1200.00")), (u'Donation', Decimal("1000.00"))]
Desired Result:
[(u'Donation', Decimal("3000.00")), (u'Paycheck', Decimal("1200.00))]
I need to sum the βquantityβ fields that have the same category name.
django django-orm
John magistr
source share