August 2016
Beginner to intermediate
717 pages
15h 24m
English
Once you have created categories in your app, you need to display them hierarchically in a template. The easiest way to do this is to use the {% recursetree %} template tag from the django-mptt app. I will show you how to do that in this recipe.
Make sure that you have the Category model created and some categories entered in the database.
Pass QuerySet of your hierarchical categories to the template and then use the {% recursetree %} template tag as follows:
# movies/views.py # -*- coding: UTF-8 -*- from __future__ import unicode_literals from django.shortcuts import render from .models import Category def movie_category_list(request): ...Read now
Unlock full access