At one point in my program, I save a timezone aware (ISO8601 with Z) datetime:
param.updated=iso8601.parse_date(updated)
param.save
Later, I retrieve it to do a comparison:
if (newparam.update > Parameter.objects.get(id=id).updated):
....
Result:
TypeError: can't compare offset-naive and offset-aware datetimes
What am I doing wrong? Am I losing the timezone-awareness when I’m saving, or when I retrieve? How can I restore it?
Python 2.6.x, Django 1.3
Django 1.4 has support for timezones, check this out.