Code
Let’s say I have the following model:
class Course(models.Model):
title = models.CharField(max_length=48)
YEAR_CHOICES = [(r, r) for r in range(
datetime.date.today().year-1, datetime.date.today().year+2
)
]
year = models.IntegerField(_('year'), choices=YEAR_CHOICES)
Question
Will the datetime.date.today()
statements be evaluated right when the model is migrated, or will they be evaluated whenever the user accesses a form to set the year
value for the Course
model?
In other words, is my YEAR_CHOICES
code above frozen to when I migrated my model or will it dynamically update as the years go by?