mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-20 11:00:35 +00:00
[Bugfix] 修复创建资产节点的Bug (#3308)
This commit is contained in:
@@ -25,10 +25,12 @@ class NodeSerializer(BulkOrgResourceModelSerializer):
|
||||
read_only_fields = ['key', 'org_id']
|
||||
|
||||
def validate_value(self, data):
|
||||
if not self.instance and not data:
|
||||
return data
|
||||
if self.instance:
|
||||
instance = self.instance
|
||||
siblings = instance.get_siblings()
|
||||
else:
|
||||
instance = Node.org_root()
|
||||
siblings = instance.get_children()
|
||||
if siblings.filter(value=data):
|
||||
raise serializers.ValidationError(
|
||||
_('The same level node name cannot be the same')
|
||||
|
Reference in New Issue
Block a user