0
两个领域我有以下查询:如何繁殖在Django
result = self.order_items.values('rate', 'rate_description')
.annotate(quantity=Count('rate')).order_by('-quantity')
它给了我这样的:
[{'rate_description': u'CC only', 'rate': Decimal('121.00'), 'quantity': 2}]
我怎么会还获得了数量*率是多少?得到的答案应该给我:
[{'rate_description': u'CC only', 'rate': Decimal('121.00'), 'quantity': 2,
'total': 242}]
难道你们就不能只计算它在Python?即'obj [“total”] = obj [“rate”] * obj [“quantity”]' – univerio