[Answer]-Django, get number of items from each author, return authors with most items

1👍

The bellow queryset should do the job:

authors = Blog.objects.values('author__picture').annotate(posts=Count('author')).order_by('-posts')[:6]

Leave a comment