result = Questionnaire.objects.extra(select={'year':
    'EXTRACT(year FROM register)', 'month': 'EXTRACT(month FROM register)',
    'yes': 'satisfaction = 1', 'no': 'satisfaction = 0'}).annotate(yes_count
    =models.Sum('yes'), no_count=models.Sum('no')).order_by('year', 'month'
    ).values('yes_count', 'no_count', 'month', 'year')
Подсчет вариантов в django