django queryset group by count

42

django queryset group by count -

 from django.db.models import Count

 result = Books.objects.values('author')
                       .order_by('author')
                       .annotate(count=Count('author'))

Comments

Submit
0 Comments