错误提示:'str' object has no attribute 'tzinfo'

记得关注我
这是什么问题呢?
在数据库中你定义了一个时间,但是这个时间字段是字符串类型的,
在数据库查询的时候当然会报错,因为字符串的属性中没有时间的属性。
错误提示
‘str’ object has no attribute ‘tzinfo’
解决方案:
在models.py中,编辑数据类型
edit_date = models.DateTimeField(‘Edit the date’, auto_now=True)

猜你喜欢

转载自blog.csdn.net/zhaojikun521521/article/details/83825026
今日推荐