[英]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):我有一个 Django 查询集 object 看起来像这样(它是派生的查询集,而不是模型的查询集):
<QuerySet [{'A': 2, 'B':3, 'C':0 }, {'A': 1, 'B':2, 'C':1 }]>
How can I append a new instance containing sum of instances within the queryset to that queryset?我怎样才能 append 一个包含查询集中实例总和的新实例到该查询集? That is, I need to make a new (or the same) queryset that looks like this:也就是说,我需要创建一个新的(或相同的)查询集,如下所示:
<QuerySet [{'A':2, 'B':3, 'C':0 }, {'A':1, 'B':2, 'C':1 },
{'A':3, 'B':5, 'C':1 }]>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.