Commit 70664d43 authored by jym503558564's avatar jym503558564

[Update] 修改小问题

parent ee97144a
...@@ -68,18 +68,18 @@ class AssetPermissionViewSet(viewsets.ModelViewSet): ...@@ -68,18 +68,18 @@ class AssetPermissionViewSet(viewsets.ModelViewSet):
node_id = self.request.query_params.get('node_id') node_id = self.request.query_params.get('node_id')
node_name = self.request.query_params.get('node') node_name = self.request.query_params.get('node')
if node_id: if node_id:
nodes = Node.objects.filter(pk=node_id) _nodes = Node.objects.filter(pk=node_id)
elif node_name: elif node_name:
nodes = Node.objects.filter(value=node_name) _nodes = Node.objects.filter(value=node_name)
else: else:
return queryset return queryset
if not nodes: if not _nodes:
return queryset.none() return queryset.none()
related_nodes = [] nodes = set()
for node in nodes: for node in _nodes:
[related_nodes.append(item) for item in node.get_ancestors(with_self=True)] nodes |= set(node.get_ancestors(with_self=True))
queryset = queryset.filter(nodes__in=related_nodes) queryset = queryset.filter(nodes__in=nodes)
return queryset return queryset
def filter_asset(self, queryset): def filter_asset(self, queryset):
......
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