1👍
Have you tried using a timezone aware datetime? e.g.
datetime.datetime(2013, 11, 20, 20, 8, 7, 127325, tzinfo=<UTC>)
You can make it like this:
import pytz
timezone_aware_time = pytz.timezone('UTC').localize(datetime.datetime(2013, 11, 20, 20, 8, 7, 127325))
To get your string into a compliant format and then give it a timezone, do this:
import datetime from datetime
datetime.strptime('2016-1-5T5:00:00', '%Y-%m-%dT%H:%M:%S')
So, altogether:
import pytz
import datetime from datetime
timezone_aware_time = pytz.timezone('UTC').localize(datetime.strptime('2016-1-5T5:00:00', '%Y-%m-%dT%H:%M:%S'))
For reference, auto_now is in timezone UTC.
Source:stackexchange.com