Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个简单的聚合:
tot=PurchaseOrderLine.objects.aggregate(total=Sum('price')) return HttpResponse(tot)
这将返回“总计”。
如果我做:
return HttpResponse(str(tot))
它显示"{'total': Decimal('321.60')}"
"{'total': Decimal('321.60')}"
我如何从中获得 NUMERIC var!
tot=PurchaseOrderLine.objects.aggregate(total=Sum('price'))['total'] return HttpResponse(tot)