增加myschedule model

This commit is contained in:
caoqianming 2023-03-03 10:03:10 +08:00
parent 0bb4595ee6
commit f96a62d5e9
1 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@ from django.contrib.auth.models import UserManager
from django.db import models
from django.contrib.auth.models import AbstractUser
from apps.utils.models import CommonADModel, CommonAModel, CommonBModel, BaseModel, SoftDeletableManagerMixin
from django_celery_beat.models import IntervalSchedule, CrontabSchedule
class DataFilter(models.IntegerChoices):
@ -237,3 +238,17 @@ class File(CommonAModel):
def __str__(self):
return self.name
class MySchedule(CommonAModel):
"""
常用周期
"""
MS_TYPE = (
(10, '间隔'),
(20, '定时')
)
name = models.CharField('名称', max_length=200)
type = models.PositiveSmallIntegerField('周期类型', default=10)
interval = models.ForeignKey(IntervalSchedule, on_delete=models.PROTECT, null=True, blank=True)
crontab = models.ForeignKey(CrontabSchedule, on_delete=models.PROTECT, null=True, blank=True)