Django ORM,group_by是按所有值分组的

2024-03-29 14:25:07 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图使用

products = products.annotate(count_prices=Count('prices'))

不幸的是它使用了所有的select参数:(

如何强制按一个字段分组?我举了很多例子

^{pr2}$

它正在将它添加到groupby中。有什么想法吗?在


Tags: 参数countselect例子productspricesgroupbyannotate