Reputation: 3
I have a simple Aggregate:
tot=PurchaseOrderLine.objects.aggregate(total=Sum('price'))
return HttpResponse(tot)
This returns "total".
If I do:
return HttpResponse(str(tot))
It displays "{'total': Decimal('321.60')}"
How do I get the NUMERIC var out of this!
Upvotes: 0
Views: 93
Reputation: 30482
tot=PurchaseOrderLine.objects.aggregate(total=Sum('price'))['total']
return HttpResponse(tot)
Upvotes: 1