How Append Sum Of Instances Within A Django Queryset To That Queryset?
I have a Django Queryset object that looks like this (it is a derived queryset, not a queryset for a Model): H
Solution 1:
I don't think you can do that. But if you use aggregate
then you will be able to get the sum of A
, B
, C
like this:
>> result = YourModel.objects.aggregate(A=Sum('A'), B=Sum('B'), C=Sum('C'))
>> print(result)
Post a Comment for "How Append Sum Of Instances Within A Django Queryset To That Queryset?"