4

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

script:

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)

How can I suppress naive datetime warnings?

schneck
  • 10,556
  • 11
  • 49
  • 74
cutteeth
  • 2,148
  • 3
  • 25
  • 45
  • possible duplicate of [RuntimeWarning: DateTimeField received a naive datetime](http://stackoverflow.com/questions/18622007/runtimewarning-datetimefield-received-a-naive-datetime) – zom-pro Aug 10 '15 at 15:47

1 Answers1

-1

Just disable the usage of timezones, as stated in the documentation:

USE_TZ = False
schneck
  • 10,556
  • 11
  • 49
  • 74
  • 6
    Its already set to false. Is there a way to suppress the error messages? I mean I dont want them to appear in the terminal. – cutteeth Nov 07 '14 at 04:27