django-treebeard¶
django-treebeard is a library that implements efficient tree implementations for the Django Web Framework 1.8+, written by Gustavo Picón and licensed under the Apache License 2.0.
django-treebeard is:
Flexible: Includes 3 different tree implementations with the same API:
Fast: Optimized non-naive tree operations
Easy: Uses Django’s model-inheritance with abstract-base-classes. to define your own models.
Clean: Testable and well tested code base. Code/branch test coverage is above 96%.
Overview¶
Reference¶
- API
NodeNode.add_root()Node.add_child()Node.add_sibling()Node.delete()Node.get_tree()Node.get_depth()Node.get_ancestors()Node.get_children()Node.get_children_count()Node.get_descendants()Node.get_descendant_count()Node.get_first_child()Node.get_last_child()Node.get_first_sibling()Node.get_last_sibling()Node.get_prev_sibling()Node.get_next_sibling()Node.get_parent()Node.get_root()Node.get_siblings()Node.is_child_of()Node.is_descendant_of()Node.is_sibling_of()Node.is_root()Node.is_leaf()Node.move()Node.save()Node.get_first_root_node()Node.get_last_root_node()Node.get_root_nodes()Node.load_bulk()Node.dump_bulk()Node.find_problems()Node.fix_tree()Node.get_descendants_group_count()Node.get_annotated_list()Node.get_annotated_list_qs()Node.get_database_vendor()
- Materialized Path trees
- Nested Sets trees
- Adjacency List trees
- Exceptions