我看到这篇文章Is Django corrupting timezone-aware DateTimeField when saving it to the Database?,但它专门使用pytz和mysql,以及哪些地方我不使用pytz并使用SQLite(因为它可能会产生影响)。 我有以下型号 class ScheduleItem(models.Model):
work_date =
setings.py:-
USE_TZ = True
TIME_ZONE = 'America/Chicago'
class MyModel(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
# time zone related field
user
我有一个Django(v1.10.6)的项目,有一些机型日期时间字段,例如: created_at = models.DateTimeField(auto_now_add=True)
存储在PostgreSQL数据库没有时区信息: created_at timestamp without time zone NOT NULL
postgresql.conf: timezone = 'UTC
我在models.py from django.db import models
class Blog(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
created = models.DateTimeField(auto_now_add=True)