私は、django pollsアプリケーションのサンプルをビルドしています。私は選択肢のないすべての世論調査を除外したい。フィルター関連モデルdjango
return Question.objects.filter(
pub_date__lte=timezone.now()
).exclude(
choice_set__count=0
).order_by('-pub_date')[:5]
しかし、フィールドエラーでこのクエリ結果:
Cannot resolve keyword 'choice_set' into field. Choices are: choice, id, pub_date, question_text
私は、クエリからモデルを関連問い合わせることができますどのように、私は、関連する選択肢のオブジェクトにアクセスする必要がありますか?