Commit c1db3371 authored by BaiJiangJie's avatar BaiJiangJie

[Bugfix] 修复资产授权树root节点bug

parent e66cfc2e
......@@ -123,7 +123,7 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
def get_object(self):
pk = self.kwargs.get('pk') or self.request.query_params.get('id')
if not pk:
node = Node.root()
node = None
else:
node = get_object_or_404(Node, pk=pk)
return node
......@@ -133,7 +133,8 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
query_all = self.request.query_params.get("all")
query_assets = self.request.query_params.get('assets')
node = self.get_object()
if node == Node.root():
if node is None:
node = Node.root()
queryset.append(node)
if query_all:
children = node.get_all_children()
......@@ -184,8 +185,6 @@ class NodeAddChildrenApi(generics.UpdateAPIView):
for node in children:
if not node:
continue
# node.parent = instance
# node.save()
node.set_parent(instance)
return Response("OK")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment