Suppress django naive datetime warnings

I'm interested in a script that includes the datetime module. I have to suppress "the object got the naive datetime while the timezone is active" as there are other print statements in the script. My code is 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 date warnings?

+3


source to share


1 answer


Just disable the use of timezones, as the documentation states:



USE_TZ = False

      

0


source







All Articles