fix(ops): 修复任务schedule属性的bug

pull/4771/head
ibuler 2020-10-12 19:08:13 +08:00 committed by 老广
parent 5a87634c26
commit 2190db1bb5
1 changed files with 2 additions and 4 deletions

View File

@ -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