>>> qs=Question.objects.extra(select={'anum': 'SELECT COUNT(*) FROM questions_answer WHERE questions_answer.question_id = questions_question.id'},).extra(order_by=['-anum'])
>>> [q.anum for q in qs]
[3, 3, 3, 3, 2, 2, 1, 1, 1, 0, 0, 0, 0]
>>> qs2=Question.objects.annotate(n=Count('answer')).order_by('-n')
>>> [q.n for q in qs2]
[3, 3, 3, 3, 2, 2, 1, 1, 1, 0, 0, 0, 0]
>>>
05-11 19:59