【发布时间】:2014-04-09 16:32:41
【问题描述】:
我已阅读与 django 聚合相关的文档,但我仍然无法弄清楚如何准确地获得每个用户的总积分。
这是我尝试过的:
ModelName.objects.filter(username=rUser.username).aggregate(Sum('points'))
我收到以下错误:
Request Method: GET
Request URL: http://localhost:8001/mypage/
Django Version: 1.4.8
Exception Type: NameError
Exception Value:
global name 'Sum' is not defined
【问题讨论】:
标签: python django django-queryset