Commit 69b91df9 authored by 八千流's avatar 八千流 Committed by BaiJiangJie

[Update]优化资产设置节点的问题 (#2786)

* [Update]优化资产设置节点的问题

* [Update]优化资产创建的节点设置
parent 3e86c074
......@@ -51,10 +51,12 @@ class AssetViewSet(IDInCacheFilterMixin, LabelFilter, BulkModelViewSet):
def set_assets_node(self, assets):
if not isinstance(assets, list):
assets = [assets]
node = Node.root()
node_id = self.request.query_params.get('node_id')
if node_id:
node = get_object_or_none(Node, pk=node_id)
if not node_id:
return
node = get_object_or_none(Node, pk=node_id)
if not node:
return
node.assets.add(*assets)
def perform_create(self, serializer):
......
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