[Fixed]-Django select_related tree path

1👍

That’s because your using .get. Since you’ve already retrieved the userEdges and have them in memory, you can do:

while ... :
    currentEdge = next(e for e in userEdges if e.nodeTo == node)
    path.append(currentEdge.nodeFrom)
👤dursk

Leave a comment