From 3eee84a34e97746f9bb41d7f8d8d25a4dd61e8a2 Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Thu, 12 Sep 2024 17:37:22 +0800 Subject: [PATCH] fix: delete ReplayStorage error --- apps/terminal/models/component/storage.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/terminal/models/component/storage.py b/apps/terminal/models/component/storage.py index 985fc1012..fb714d35b 100644 --- a/apps/terminal/models/component/storage.py +++ b/apps/terminal/models/component/storage.py @@ -127,9 +127,7 @@ class CommandStorage(CommonStorageModelMixin, JMSBaseModel): logger.error(f"Command storage `{self.type}` not support") return Command.objects.none() - def save( - self, force_insert=False, force_update=False, using=None, update_fields=None - ): + def save(self, force_insert=False, force_update=False, using=None, update_fields=None): super().save( force_insert=force_insert, force_update=force_update, @@ -205,10 +203,10 @@ class ReplayStorage(CommonStorageModelMixin, JMSBaseModel): src = os.path.join(settings.BASE_DIR, "common", target) return storage.is_valid(src, target) - def is_use(self): + def used_by(self): return Terminal.objects.filter( replay_storage=self.name, is_deleted=False - ).exists() + ) class Meta: verbose_name = _("Replay storage")