Skip to content

Commit

Permalink
obtain node resource by model name (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault authored Mar 31, 2021
1 parent a7405bf commit 85cb03e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def from_parent_deeper(
return query

@classmethod
def build_subtree_strut(self, result, *args, **kwargs):
def build_subtree_strut(cls, result, *args, **kwargs):
"""
Returns a dictionary in form of
{node:Resource, children:{node_id: Resource}}
Expand All @@ -149,7 +149,8 @@ def build_subtree_strut(self, result, *args, **kwargs):
if len(items) == 0:
return root_elem
for _, node in enumerate(items):
new_elem = {"node": node.Resource, "children": OrderedDict()}
node_res = getattr(node, cls.model.__name__)
new_elem = {"node": node_res, "children": OrderedDict()}
path = list(map(int, node.path.split("/")))
parent_node = root_elem
normalized_path = path[:-1]
Expand Down

0 comments on commit 85cb03e

Please sign in to comment.