akvo.rsr.models.tree.model module
- class akvo.rsr.models.tree.model.AkvoTreeModel(*args, **kwargs)[source]
Bases:
TreeModel
- ancestors(with_self=True) AkvoTreeQuerySet [source]
Get ancestors sorted by closest to farthest
That means parent, then parent’s parent, etc.
- descendants(max_depth: int | None = None, with_self: bool = True)[source]
All sub-nodes and their subnodes and so on
- Parameters:
max_depth – Max amount of levels
with_self – Include self in the result
- get_root() AkvoTreeModel [source]
Get the root node of a tree, which can be the node itself
- property has_ancestors: bool
- property manager: AkvoTreeManager
- objects
- parent() AkvoTreeModel | None [source]
- path
- set_parent(new_parent: AkvoTreeModel, force: bool = False) AkvoTreeModel [source]
Add this node as a child to a parent
There’s NO a check if this is possible. Use the helper if you want checks
- uuid
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.