The django-mptt
app comes with a simple model administration mixin that allows you to create the tree structure and list it with indentation. To reorder trees, you need to either create this functionality yourself or use a third-party solution. Currently, there are two apps that can help you to create a draggable administration interface for hierarchical models. One of them is django-mptt-admin
. Let's take a look at it in this recipe.
First, we need to have the django-mptt-admin
app installed by performing the following steps:
To start, install the app in your virtual environment using the following command:
(myproject_env)$ pip install django-mptt-admin
Then, put it in
INSTALLED_APPS
in the settings, as follows:# conf/base.py or settings.py INSTALLED_APPS = ( # ... "django_mptt_admin" )