diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index 9ebbeda51..4dd6bf041 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -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') diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 15958f17a..568450ec4 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -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