Creating a category administration interface with django-mptt-admin

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.

Getting ready

First, we need to have the django-mptt-admin app installed by performing the following steps:

  1. To start, install the app in your virtual environment using the following command:
    (myproject_env)$ pip install django-mptt-admin
    
  2. Then, put it ...

Get Web Development with Django Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.