按ForeignKey字段的顺序排序?

按ForeignKey字段的顺序排序?,第1张

按ForeignKey字段的顺序排序?
from django.db.models import Counttop_users = User.objects.filter(problem_user=False)      .annotate(num_submissions=Count('submission'))      .order_by('-num_submissions')[:3]

你没有

problem_user
示例模型代码中提及,但在假定它为
BooleanFieldon
的情况下已将其保留
User



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4917393.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-12
下一篇2022-11-12

发表评论

登录后才能评论

评论列表(0条)

    保存