akvo.rsr.models.tree.usecases module
- akvo.rsr.models.tree.usecases.check_set_parent(node: AkvoTreeModel, new_parent: AkvoTreeModel)[source]
- akvo.rsr.models.tree.usecases.delete_parent(node: AkvoTreeModel) AkvoTreeModel [source]
Delete parent and update the descendants
- akvo.rsr.models.tree.usecases.set_parent(node: AkvoTreeModel, new_parent: AkvoTreeModel, force: bool = False)[source]
Only force if you’re sure you won’t break anything!
- akvo.rsr.models.tree.usecases.update_descendant_parents(old_path: PathValue, new_parent: AkvoTreeModel, force: bool = False) List[AkvoTreeModel] [source]
Basically updates a given tree and makes this node the parent
Made private as it has the potential to destroy trees and shouldn’t be called willy-nilly.
- Parameters:
old_path – The old path to this node that can be used to find old descendants
new_parent –
force – For the parent to be set and don’t do checks
- Returns:
The updated descendants (may or may not be reflected in the DB depending on save)