【发布时间】:2019-12-19 03:17:23
【问题描述】:
这可能在某个地方,但不太确定如何询问。希望这将是一个快速的。假设我有一个如下表:
name count site
Guy Man 2 ABC
Guy Man 3 BCD
Guy Man 4 CDE
Girl Woman 2 ABC
Girl Woman 2 BCD
Girl Woman 3 CDE
我想对这些进行注释,以便获得名称、总数和站点列表。所以根据上面的数据,我会得到以下数据。
[
{
"name": "Guy Man",
"count_total": 9,
"site_list": "ABC, BCD, CDE"
},
{
"name": "Girl Woman",
"count_total": 7,
"site_list": "ABC, BCD, CDE"
}
]
我了解如何获取count_total,但我不确定如何获取site_list。有什么想法吗?
【问题讨论】:
标签: django django-queryset django-annotate