django-admin-sortable2¶
is a generic drag-and-drop ordering package to sort objects in the list- and detail inline-views
of the Django admin interface. This package offers simple mixin classes which enriches the
functionality of any existing class derived from admin.ModelAdmin
, admin.StackedInline
or admin.TabularInline
. It thus makes it very easy to integrate with existing models and their
model admin interfaces.
Project home: https://github.com/jrief/django-admin-sortable2

Features¶
Must not inherit from any special Model base class¶
Other plugins offering functionality to make list views for the Django admin interface sortable,
offer a base class to be used instead of models.Model
. This class then contains a hard coded
position field, additional methods, and meta directives.
By using a mixin to enrich an existing class with sorting, we can integrate this Django-app into existing projects with minimal modification to the code base.
Intuitive List View¶
By adding a draggable area into one of the columns of the Django admin’s list view, sorting rows becomes very intuitive. Alternatively, rows can be selected using the checkbox and sorted as a group.
If rows have to be sorted accross pages, they can be selected using the checkbox and moved to any other page using an Admin action.
Support for Stacked- and Tabular Inlines¶
If a Django admin view uses InlineModelAdmin objects, and the related model provides an ordering field, then those inline models can be sorted in the detail view.
Contents:¶
- Installation
- Using Admin Sortable
- Prepare the Model Classes
- In Django’s Admin, make the List View sortable
- In Django’s Admin Detail View, make Stacked- and Tabular-Inlines sortable
- Sortable Many-to-Many Relations with Sortable Inlines
- Initial data
- Note on unique indices on the ordering field
- Usage in combination with other libraries
- Contributing to the Project