From 7ceb27301b5a64d48f80014ce0fd6cab2402bc7e Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:23:18 +0800 Subject: [PATCH] perf: automation task name validate (#9690) Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/automations/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/accounts/serializers/automations/base.py b/apps/accounts/serializers/automations/base.py index 6b3792559..cdb08bf36 100644 --- a/apps/accounts/serializers/automations/base.py +++ b/apps/accounts/serializers/automations/base.py @@ -38,7 +38,7 @@ class BaseAutomationSerializer(PeriodTaskSerializerMixin, BulkOrgResourceModelSe } def validate_name(self, name): - if self.instance: + if self.instance and self.instance.name == name: return name if BaseAutomation.objects.filter(name=name, type=self.model_type).exists(): raise serializers.ValidationError(_('Name already exists'))