Reverse Queryset Order in Django -
this question has answer here:
i guess question super simple , short but...
is there simple way reverse order of queryset in django?
example:
li = [1,2,3]
queryset = collection.objects.filter(pk__in = li)
you can use
queryset = reversed(collection.objects.filter(pk__in = li))
or
queryset = collection.objects.filter(pk__in = li).reverse()
Comments
Post a Comment