Django Reorder¶
A project that helps sorting querysets in a specific order
Documentation¶
The full documentation is at https://django-reorder.readthedocs.org.
Quickstart¶
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 Usage page.
Features¶
- 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).
Running Tests¶
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements_test.txt
(myenv) $ python runtests.py