Below is a request to receive all questions that are not related to answers:
Question.objects.annotate(answer_count=Count('answer')).filter(answer_count=0)
Update:
You can behave using any parameters annotate, the same as real model fields in the filtering method, for example, all questions that have more than three answers:
Question.objects.annotate(answer_count=Count('answer')).filter(answer_count__gt=3)
:
?
ORM -db SQL, SQL , , SELECT, , . :
SELECT count(*) from my_table;
count , , , .
Django ORM SQL, funtion SQL .
anneate aboute