[Update] 不选择节点默认导出所有

This commit is contained in:
ibuler
2018-08-15 15:01:27 +08:00
parent 7ddf7f2a79
commit 00928dd46d
2 changed files with 6 additions and 5 deletions

View File

@@ -214,13 +214,13 @@ class AssetExportView(LoginRequiredMixin, View):
def post(self, request, *args, **kwargs):
try:
assets_id = json.loads(request.body).get('assets_id', [])
assets_node_id = json.loads(request.body).get('node_id', None)
node_id = json.loads(request.body).get('node_id', None)
except ValueError:
return HttpResponse('Json object not valid', status=400)
if not assets_id and assets_node_id:
assets_node = get_object_or_none(Node, id=assets_node_id)
assets = assets_node.get_all_assets()
if not assets_id:
node = get_object_or_none(Node, id=node_id) if node_id else Node.root()
assets = node.get_all_assets()
for asset in assets:
assets_id.append(asset.id)