django-reorder

A project that helps sorting querysets in a specific order


Keywords
django-reorder
License
MIT
Install
pip install django-reorder==0.2.1

Documentation

Django Reorder

https://badge.fury.io/py/django-reorder.png

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 :doc:`usage` page.

Features

  • Can be used in order_by() and in annotate() 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

Credits

Tools used in rendering this package: