add get views for schedules, #723

This commit is contained in:
Simon
2024-08-23 21:13:00 +02:00
parent 37389e91f5
commit 39b995fbf1
4 changed files with 59 additions and 1 deletions

View File

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