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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

excel vba - VBA Proxy auto-configuration for http requests -

php - phpWord - Tables with borders in headers/footers -