[Answered ]-Use order by in pagination result Django

1👍

Do you just want to order the queryset you’ve created? If so, you can use the Django ORM order_by() function – see the Django documentation:

https://docs.djangoproject.com/en/4.0/ref/models/querysets/#order-by

Your code that follows if ordering: is a duplicate of the code that precedes it, I would suggest checking the ordering at the start of your view and then putting it into the order_by() function if it exists

👤0sVoid

Leave a comment