取消dnago天真日期时间警告 [英] suppress django naive datetime warnings

查看:57
本文介绍了取消dnago天真日期时间警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我担心涉及datetime模块的脚本.我必须禁止对象在时区处于活动状态时收到原始日期时间",因为脚本中还有其他打印语句.我的代码如下

I am concerned with a script that involves datetime module. I have to suppress 'object received a naive datetime while timezone is active' as there are other print statements in the script. My code is as below

脚本:

from datetime import datetime
date = datetime.now()

objName = className.objects.create(param=value, param=value, param=value, time=date, attachment=attachment)

models.py

models.py

class className(models.MOdel):
    t = models.DateTimeField(null=True, blank=True)

如何取消朴素的日期时间警告?

How can I suppress naive datetime warnings?

推荐答案

只需禁用时区,如 查看全文

相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆