[Bugfix] 修复创建资产节点的Bug (#3308)

pull/3311/head
BaiJiangJie 2019-10-08 11:57:22 +08:00 committed by 老广
parent 16d2b0f1f3
commit 90ec6a2962
1 changed files with 6 additions and 4 deletions

View File

@ -25,10 +25,12 @@ class NodeSerializer(BulkOrgResourceModelSerializer):
read_only_fields = ['key', 'org_id'] read_only_fields = ['key', 'org_id']
def validate_value(self, data): def validate_value(self, data):
if not self.instance and not data: if self.instance:
return data instance = self.instance
instance = self.instance siblings = instance.get_siblings()
siblings = instance.get_siblings() else:
instance = Node.org_root()
siblings = instance.get_children()
if siblings.filter(value=data): if siblings.filter(value=data):
raise serializers.ValidationError( raise serializers.ValidationError(
_('The same level node name cannot be the same') _('The same level node name cannot be the same')