August 2016
Beginner to intermediate
717 pages
15h 24m
English
To illustrate how to deal with MPTT, we will create a movies app that will have a hierarchical Category model and a Movie model with a many-to-many relationship with the categories.
To get started, perform the following steps:
django-mptt in your virtual environment using the following command:
(myproject_env)$ pip install django-mptt
movies app. Add the movies app as well as mptt to INSTALLED_APPS in the settings, as follows:
# conf/base.py or settings.py
INSTALLED_APPS = (
# ...
"mptt",
"movies",
)We will create a hierarchical Category model and a Movie model, which will have a many-to-many relationship with the categories, as follows:
models.py file and ...Read now
Unlock full access