perf: 修改默认节点

pull/10235/head
ibuler 2 years ago
parent 52891bfca3
commit 5921b2ee8f

@ -59,7 +59,7 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer):
def set_uniq_name_if_need(self, initial_data, asset):
name = initial_data.get('name')
if name is None:
if name is not None:
return
if not name:
name = initial_data.get('username')

@ -267,12 +267,13 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali
nodes_display = self.initial_data.get('nodes_display')
if nodes_display:
return nodes
default_node = Node.org_root()
request = self.context.get('request')
if not request:
return []
return [default_node]
node_id = request.query_params.get('node_id')
if not node_id:
return []
return [default_node]
nodes = Node.objects.filter(id=node_id)
return nodes

Loading…
Cancel
Save