37👍
✅
You can use
queryset = reversed(Collection.objects.filter(pk__in = li))
or
queryset = Collection.objects.filter(pk__in = li).reverse()
9👍
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))
- Problem launching docker-compose : python modules not installed
- Changing password in Django Admin
- Installing django 1.5(development version) in virtualenv
- How does django-nose differ from the default Django test-runner
- How does this Man-In-The-Middle attack work?
Source:stackexchange.com