I am trying to set a DateTimeField for one of my django models. My code looks like this:
dt = datetime.fromtimestamp(mktime(parsed_feed.updated_parsed))
feed.updated = dt
updated_parsed is struct in the format :
time.struct_time(tm_year=2016, tm_mon=4, tm_mday=26, tm_hour=8, tm_min=20, tm_sec=43, tm_wday=1, tm_yday=117, tm_isdst=0)
And updated is obviously the django DateTimeField. I am trying to convert the struct into a datetime object, and then set it to my field. Everything works nicely, and the correct date and time is set, however, I get this error (warning) in my console:
RuntimeWarning: DateTimeField Feed.updated received a naive datetime (2016-04-26 08:25:08) while time zone support is active.
RuntimeWarning)
How do I integrate timezone support into the datetime object (dt)?