A project that helps sorting querysets in a specific order
The full documentation is at https://django-reorder.readthedocs.org.
Install Django Reorder:
pip install django-reorder
Then use it in a project:
from django_reorder.reorder import reorder Tshirt.objects.order_by(reorder(size=['S', 'M', 'L']))
Some more detailed examples can be foind on the :doc:`usage` page.
- Can be used in
order_by()
and inannotate()
calls. - Works across relationships.
- Lets you control the sorting order of
NULL
values explicitly (otherwise it can vary across databases).
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install -r requirements_test.txt (myenv) $ python runtests.py
Tools used in rendering this package: