You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to initialize an empty tree. I used the following code based on the example in the doc:
# if the table is emptyifnotcurrent_session.query(TreeDelcaretiveClass).all():
tree_manager.register_events(remove=True)
# Hard code the tree_id since I know this is the first node and the only root node in the current treeroot=TreeDelcaretiveClass(name="Root", tree_id=1)
# Hard code the left since I know the initial value for the left must be 1root.left=1# Hard code the right since I know the initial value for the right must be 2root.right=2current_session.add(root)
current_session.commit()
tree_manager.register_events()
TreeDeclaretiveClass.rebuild_tree(current_session, TreeDeclaretive.tree_id)
Maybe this can be a function in the mixin module that help user initialize the empty tree?
With at least one item in the tree (even if it is not used), tree will be very easy to use afterward.
The text was updated successfully, but these errors were encountered:
Hi!
In order to initialize an empty tree. I used the following code based on the example in the doc:
Maybe this can be a function in the mixin module that help user initialize the empty tree?
With at least one item in the tree (even if it is not used), tree will be very easy to use afterward.
The text was updated successfully, but these errors were encountered: