django-treebeard¶
django-treebeard is a library that implements efficient tree implementations for the Django Web Framework, originally written by Gustavo Picón and licensed under the Apache License 2.0.
django-treebeard is:
Flexible: Includes 4 different tree implementations with the same API:
PostgreSQL Ltree (experimental)
Fast: Optimized non-naive tree operations
Easy: Uses Django’s Model inheritance to define your own models.
Clean: Testable and well tested code base. Code test coverage is above 96%.
Overview¶
Reference¶
- API
NodeNodeManagerNodeManager.add_root()NodeManager.add_child()NodeManager.add_sibling()NodeManager.move()NodeManager.get_tree()NodeManager.get_first_root_node()NodeManager.get_last_root_node()NodeManager.get_root_nodes()NodeManager.get_ancestors()NodeManager.get_children()NodeManager.get_children_count()NodeManager.get_descendants()NodeManager.get_descendant_count()NodeManager.get_first_child()NodeManager.get_last_child()NodeManager.get_first_sibling()NodeManager.get_last_sibling()NodeManager.get_prev_sibling()NodeManager.get_next_sibling()NodeManager.get_parent()NodeManager.get_root()NodeManager.get_siblings()NodeManager.load_bulk()NodeManager.dump_bulk()NodeManager.get_descendants_group_count()NodeManager.get_annotated_list()NodeManager.get_annotated_list_qs()
- Materialized Path trees
- Nested Sets trees
- Adjacency List trees
- PostgreSQL Ltree trees (experimental)
- Exceptions