3
我關心涉及日期時間模塊的腳本。因爲腳本中還有其他打印語句,所以我必須禁止'對象在時區處於活動狀態時收到了天真的日期時間'。我的代碼如下壓制django天真日期時間警告
腳本:
from datetime import datetime
date = datetime.now()
objName = className.objects.create(param=value, param=value, param=value, time=date, attachment=attachment)
models.py
class className(models.MOdel):
t = models.DateTimeField(null=True, blank=True)
我怎樣才能抑制天真的日期時間的警告?
的可能重複的[RuntimeWarning:DateTimeField字段接收到的日期時間幼稚(http://stackoverflow.com/questions/18622007/runtimewarning-datetimefield-received- a-naive-datetime) – 2015-08-10 15:47:07