how order dictionory of distict values (extracted queryset) based on count of occurrence?
example:
query = self.my_queryset.filter(category='rock').values('first_name').distinct()
i want order resulting 'query' number occurrence of category 'rock'.
i using postgresql backend db, open ideas of doing in postgres itself. :) thanks!!!
convert query set list of values each value model object. can sort list using python default sort function , pass comparison function compares 2 objects based on count in original query set.
Comments
Post a Comment