我想计算有问题的所有不正确选择的数量。
我有许多选择的查询:
questions.annotate(choices_count=Count('choices'))
现在,当我只想将不正确的选择过滤到 Count 函数中时,它会返回:
无法将关键字“选择”解析为字段。
questions.annotate(choices_count=Count(Case(When(choice__correct=False,then=1))))
你知道怎么做吗?
我想计算有问题的所有不正确选择的数量。
我有许多选择的查询:
questions.annotate(choices_count=Count('choices'))
现在,当我只想将不正确的选择过滤到 Count 函数中时,它会返回:
无法将关键字“选择”解析为字段。
questions.annotate(choices_count=Count(Case(When(choice__correct=False,then=1))))
你知道怎么做吗?