fix: delete ReplayStorage error

pull/14146/head
wangruidong 2 months ago committed by Bryan
parent ab29df5991
commit 3eee84a34e

@ -127,9 +127,7 @@ class CommandStorage(CommonStorageModelMixin, JMSBaseModel):
logger.error(f"Command storage `{self.type}` not support") logger.error(f"Command storage `{self.type}` not support")
return Command.objects.none() return Command.objects.none()
def save( def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
self, force_insert=False, force_update=False, using=None, update_fields=None
):
super().save( super().save(
force_insert=force_insert, force_insert=force_insert,
force_update=force_update, force_update=force_update,
@ -205,10 +203,10 @@ class ReplayStorage(CommonStorageModelMixin, JMSBaseModel):
src = os.path.join(settings.BASE_DIR, "common", target) src = os.path.join(settings.BASE_DIR, "common", target)
return storage.is_valid(src, target) return storage.is_valid(src, target)
def is_use(self): def used_by(self):
return Terminal.objects.filter( return Terminal.objects.filter(
replay_storage=self.name, is_deleted=False replay_storage=self.name, is_deleted=False
).exists() )
class Meta: class Meta:
verbose_name = _("Replay storage") verbose_name = _("Replay storage")

Loading…
Cancel
Save