Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #repeated #instance #queryset #django
ADD COMMENT
Topic
Name
3+8 =