mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-08 06:20:31 +00:00
add get views for schedules, #723
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
"""task model"""
|
||||
|
||||
from django.db import models
|
||||
from django_celery_beat.models import PeriodicTask
|
||||
from django_celery_beat.models import PeriodicTask, cronexp
|
||||
|
||||
|
||||
class CustomPeriodicTask(PeriodicTask):
|
||||
"""add custom metadata to task"""
|
||||
|
||||
task_config = models.JSONField(default=dict)
|
||||
|
||||
@property
|
||||
def schedule_parsed(self):
|
||||
"""parse schedule"""
|
||||
minute = cronexp(self.crontab.minute)
|
||||
hour = cronexp(self.crontab.hour)
|
||||
day_of_week = cronexp(self.crontab.day_of_week)
|
||||
|
||||
return f"{minute} {hour} {day_of_week}"
|
||||
|
||||
Reference in New Issue
Block a user