Q:

Reverse Queryset Order in Django

Is there any simple way to reverse the order of a queryset in Django?
Example:
li = [1, 2, 3]

queryset = Collection.objects.filter(pk__in=li)

A:

You can use
queryset = reversed(Collection.objects.filter(pk__in = li))

or
queryset = Collection.objects.filter(pk__in = li).reverse()

A:

To reverse qs
queryset = Collection.objects.filter(pk__in = li).order_by('field_name')

If for some reason you don't want to use order_by then  reverse list
queryset = Collection.objects.filter(pk__in = li)
result = reversed(list(queryset))

