group by with count using annotate
Case.objects.filter(is_active=True).values('status').annotate(total=Count('status')).order_by('status')