To illustrate how to deal with MPTT, we will build on top of the movies app from the Filtering object lists recipe in Chapter 3, Forms and Views. In our changes, we will add a hierarchical Category model and update the Movie model to have a many-to-many relationship with the categories. Alternatively, you can create the app fresh, using only the content shown here to implement a very basic version of the Movie model from scratch.
Creating hierarchical categories with django-mptt
Getting ready
To get started, perform the following steps:
- Install django-mptt in your virtual environment using the following command (or add the same to your requirements file and rebuild if using a Docker project):
(myproject_env)$ pip3 install...