Adds simple, drag-and-drop object ordering to the Django administration change list view and to inlines within add/edit views.
Option A: pip
pip install -e "git://github.com/tkaemming/django-orderable.git#egg=django-orderable"
Option B: manual checkout
- Clone the django-orderable repository from GitHub.
python setup.py installto install the module package.
Option C: PyPI
INSTALLED_APPStuple for your Django project.
- Make sure you have Django staticfiles configured.
Define Your Models
For any models that you would like to add ordering to, have these
Alternatively, (particularly if you are working with legacy data), you may
orderable.models.BaseOrderableModel. Then ensure that you define
order field (preferrably a
PositiveIntegerField) and that you have
ordering = ('order',) in your
Adding Ordering to Change List View
Ensure that your model is orderable (see "Define Your Models" above).
Define your ModelAdmin class as usual, but subclass
orderable.admin.OrderableAdmin instead of
Note: Make sure that in your
is set to a value that is greater than the possible number of objects (this
attribute defaults to 100). If you're looking to order an inordinate number
of model instances, you might want to look elsewhere for your ordering
Adding Orderable Administration Inlines
Ensure that the model being inlined (the "inner" model) is orderable (see "Define Your Models" above).
Define your admin.py inlines as usual, but subclass either
orderable.admin.OrderableTabularInline (instead of the standard
"Stacked" inlines can be dragged from the "header" of the item.
"Tabular" inlines can be dragged from anywhere inside the item row.
Please note that this isn't a fool-proof solution to ordering objects in
every scenario. However, this app is useful for small applications where
the change list will not be paginated beyond the first page of model
instances. There are a lot of cases where this application isn't the
appropriate solution (at least currently), such as objects that are ordered
with respect to a related object, situations where the
list_filter will be
A test application is bundled with this repository, showing an example of
how to use
BaseOrderableModel and the various admin
The source code and usage instructions can be found in the
directory of this repository.