dvlyadmin_pro/backend/apps/lycrontab/views/celery_crontab_schedule.py
2025-03-18 08:46:50 +08:00

40 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/python
#coding: utf-8
# +-------------------------------------------------------------------
# | system: django-vue-lyadmin
# +-------------------------------------------------------------------
# | Author: lybbn
# +-------------------------------------------------------------------
# | QQ: 1042594286
# +-------------------------------------------------------------------
# ------------------------------
# django_celery_beat CrontabSchedule view
# ------------------------------
from django_celery_beat.models import CrontabSchedule
from utils.serializers import CustomModelSerializer
from utils.viewset import CustomModelViewSet
class CrontabScheduleSerializer(CustomModelSerializer):
class Meta:
model = CrontabSchedule
read_only_fields = ["id"]
exclude = ('timezone',)
# fields = '__all__'
class CrontabScheduleModelViewSet(CustomModelViewSet):
"""
crontab 的周期性任务同linux的crontab
minute="0" 分钟
hour="*" 小时
day_of_week="*" 每周的星期几
day_of_month="10-15" 每月的某一天或间隔
month_of_year="*" 每年的某一个月
"""
queryset = CrontabSchedule.objects.all()
serializer_class = CrontabScheduleSerializer