解决can't subtract offset-naive and offset-aware datetimes 的一种方式
Django Version: | 3.2.16 |
---|---|
Exception Type: | TypeError |
Exception Value: | can't subtract offset-naive and offset-aware datetimes |
解决方法:
把时间转换为字符串格式
修改前:
obj.create_time修改后:
obj.create_time.strftime('%Y-%m-%d %H:%M:%S')