From 2190db1bb5174987ada72b80d7147b5acf324ec4 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 12 Oct 2020 19:08:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(ops):=20=E4=BF=AE=E5=A4=8D=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1schedule=E5=B1=9E=E6=80=A7=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/mixin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/ops/mixin.py b/apps/ops/mixin.py index fd6f9cf27..166c5db75 100644 --- a/apps/ops/mixin.py +++ b/apps/ops/mixin.py @@ -95,10 +95,8 @@ class PeriodTaskModelMixin(models.Model): @property def schedule(self): from django_celery_beat.models import PeriodicTask - try: - return PeriodicTask.objects.get(name=str(self)) - except PeriodicTask.DoesNotExist: - return None + name = self.get_register_task()[0] + return PeriodicTask.objects.filter(name=name).first() class Meta: abstract = True