Reputation: 423
I found a problematic node with id 633.
tree.find_problems()
([], [], [], [633], [35, 9, 50, 291, 464])
After running tree.fix_tree() It does not find any problems.
tree.find_problems()
([], [], [], [], [])
But actually 633 is still in some wierd state.
>>> node633.depth
0
>>> node633.path
''
Problem: node633.depth is 0 which means its not root but it does not have parent as well. Path is empty too.
This means my code will try to find parent from a node that does not have a parent.
Running fix_tree again does not fix it. Moving node633 is not an option too because:
treebeard.exceptions.InvalidMoveToDescendant: Can't move node to a descendant.
Some more info:
django-treebeard==4.3
Django==2.2.1
I haven't edited paths and depths manually.
Question: How can i fix this broken node633?
Upvotes: 0
Views: 652
Reputation: 423
I think i had nothing else to do to just delete it. I ran:
node633.delete()
tree.find_problems()
([], [], [], [], [])
Find problems is still happy.
Its not the ideal solution but any better solutions are welcome.
Upvotes: 0