【发布时间】:2011-10-02 22:22:22
【问题描述】:
有了这个:mb = self.birthdate.replace(year=date.today.year)
它给出了这个:
Caught AttributeError while rendering: 'builtin_function_or_method' object has no attribute 'year'
可以更换年份吗?
【问题讨论】:
-
你能更好地提出这个问题吗?这可能会帮助stackoverflow.com/questions/4093118/…
-
我需要更换年份来计算人的年龄。不需要将更改保存到数据库。
-
什么是生日是日期时间对象吗?
-
生日 = models.DateTimeField()