Django - replacing year in DateTimeField
With this:
开发者_StackOverflowmb = self.birthdate.replace(year=date.today.year)
It gives this:
Caught AttributeError while rendering: 'builtin_function_or_method' object has no attribute 'year'
It is possible to replace year?
The correct line is:
mb = self.birthdate.replace(year=date.today().year)
date.year is a method not a attribute
datetime.date.today
精彩评论