Reputation: 41
I have used the following query, and I am trying to get the Sum of 'fee'
reg_total_fees =orders.aggregate(all_sum=Sum('par_payment__fee'))
but I get this: {'all_sum': 1785}
Do you know how I could just get the value?
Upvotes: 0
Views: 392
Reputation: 1
reg_total_fees = orders.objects.filter(write your interesting attribute for filtering =expected value for filttering).aggregate(Sum('par_payment__fee'))['par_payment__fee__sum']
Upvotes: 0
Reputation: 931
Just access the key 'all_sum' from dictionary reg_total_fees.Below line will give you the value you need.
reg_total_fees =orders.aggregate(all_sum=Sum('par_payment__fee'))['all_sum']
Upvotes: 0
Reputation: 181
reg_total_fees =orders.aggregate(all_sum=Sum('par_payment__fee'))['all_sum']
Upvotes: 1