mirror of https://github.com/jumpserver/jumpserver
[Bugfix] 修复创建资产节点的Bug (#3308)
parent
16d2b0f1f3
commit
90ec6a2962
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue