mirror of https://github.com/jumpserver/jumpserver
[Bugfix] 修复创建node api的bug
parent
cb4afabc91
commit
ed18cb317f
|
@ -53,8 +53,7 @@ class NodeSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
def validate(self, data):
|
def validate(self, data):
|
||||||
value = data.get('value')
|
value = data.get('value')
|
||||||
instance = self.instance
|
instance = self.instance if self.instance else Node.root()
|
||||||
if not instance.is_root():
|
|
||||||
children = instance.parent.get_children().exclude(key=instance.key)
|
children = instance.parent.get_children().exclude(key=instance.key)
|
||||||
values = [child.value for child in children]
|
values = [child.value for child in children]
|
||||||
if value in values:
|
if value in values:
|
||||||
|
|
Loading…
Reference in New Issue