我正在开发一个Django应用程序来跟踪员工的假期。我不知道如何在每年的某个特定日期重新安排假期。对于如何做到这一点,是否有一些众所周知的解决方案/库
class User(models.Model):
avatar = models.ImageField(
default='images/avatars/profile.png',
upload_to=user_directory_path)
name = models.CharField(max_length=100)
title = models.CharField(max_length=200, default="Employee")
email = models.EmailField(max_length=254)
present = models.BooleanField(default=False)
code = models.CharField(max_length=4, unique=True)
date_created = models.DateTimeField(auto_now_add=True)
date_clocked = models.DateTimeField(default=timezone.now)
total_holiday = models.DecimalField(
default=28.0, decimal_places=1, max_digits=4)
holiday_remaining = models.DecimalField(
default=28.0, decimal_places=1, max_digits=4)
我的模型如上图所示,我需要在每年管理员用户定义的一天重置剩余的_假日字段
在主机中设置crontab,或者使用类似于以下的django插件:https://github.com/kraiz/django-crontab
相关问题 更多 >
编程相关推荐