Let's say I have the string:
combined_datetime_string = "July 04, 2021 12:00:00 PM MST"
and I parse it to a datetime object via:
from datetime import datetime
dateobj = datetime.strptime(combined_datetime_string, '%B %d, %Y %H:%M:%S %p %Z')
Why does Django, then, complain that RuntimeWarning: DateTimeField Task.deadline received a naive datetime (2021-07-04 12:00:00) while time zone support is active?
Of course, I could set the timezone manually on the datetime object, but that seems unnecessary. I'd have to extract the MST
part (or equivalent) of the string and figure out what timezone object that corresponds to. Shouldn't the %Z
part of the original string be able to set the timezone correctly?
What am I missing here?