整数限制范围
from django.core.validators import MaxValueValidator, MinValueValidator
start = models.IntegerField(verbose_name="开始",
validators=[
MaxValueValidator(24),
MinValueValidator(0)
])
时间运算
from django.utils import timezone
now = timezone.datetime.now()
#前一天
start = now – timezone.timedelta(hours=24, minutes=0, seconds=0)