我正在尝试创建cron应用程序,我的模型看起来像:
class Crontab(models.Model):
#Some filelds
...
...
#m2m fields From here prob starts
minute = models.ManyToManyField(Mst_Cron_Minute, db_table="crontab_minute_map")
hour = models.ManyToManyField(Mst_Cron_Hour, db_table = "crontab_hour_map")
day_of_month = models.ManyToManyField(Mst_Cron_Day_Of_Month, db_table="crontab_day_of_month_map")
month = models.ManyToManyField(Mst_Cron_Month, db_table="crontab_month_map")
day_of_week = models.ManyToManyField(Mst_Cron_Day_Of_Week, db_table="crontab_day_of_week_map")
description = models.CharField(max_length=250, blank=True)
is_active = models.IntegerField(choices=YES_NO_CHOICES)
reason_for_deactivate = models.CharField(max_length=250, blank=True)
我需要在将cron保存到数据库之前对其进行验证。
我该如何验证?我的代码应该去哪里?请帮帮我。