Chapter 8. Hierarchical Structures
In this chapter, we will cover the following recipes:
- Creating hierarchical categories
- Creating a category administration interface with django-mptt-admin
- Creating a category administration interface with django-mptt-tree-editor
- Rendering categories in a template
- Using a single selection field to choose a category in forms
- Using a checkbox list to choose multiple categories in forms
Introduction
Whether you build your own forum, threaded comments, or categorization system, there will be a moment when you need to save hierarchical structures in the database. Although the tables of relational databases (such as MySQL and PostgreSQL) are of a flat manner, there is a fast and effective way to store hierarchical structures. ...
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.