An implementation of Nested Sets trees for Django 1.0+, as described by Joe Celko in Trees and Hierarchies in SQL for Smarties.
Nested sets have very efficient reads at the cost of high maintenance on write/delete operations.
Bases: treebeard.models.Node
Abstract model to create your own Nested Sets Trees.
Attribute: a list of model fields that will be used for node ordering. When enabled, all tree operations will assume this ordering.
Example:
node_order_by = ['field1', 'field2', 'field3']
PositiveIntegerField, depth of a node in the tree. A root node has a depth of 1.
PositiveIntegerField
PositiveIntegerField
PositiveIntegerField
Returns: | A queryset of nodes ordered as DFS, including the parent. |
---|
If no parent is given, all trees are returned.
See: treebeard.Node.get_tree()
Note
This metod returns a queryset.