Answers for "get most repeated instance in a queryset django"

1

get most repeated instance in a queryset django

from django.db.models import Count

most_common = Post.objects.annotate(mc=Count('category')).order_by('-mc')[0].mc
Posted by: Guest on April-27-2020

Code answers related to "get most repeated instance in a queryset django"

Python Answers by Framework

Browse Popular Code Answers by Language