id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 19312 Time zone issue with MySQL timestamp fields mwaterfall nobody "MySQL `timestamp` fields are supported by Django ORM's `DateTimeField`, however if time zone support is enabled Django is not ensuring the Python `datetime` objects (from MySQLdb) have a default `tzinfo` applied to them (UTC) in the same way that it does when dates come from a `datetime` MySQL field. Because of this, when saving the model after it has just been read from the database, Django throws a naive datetime / time zone warning from within the field's `get_prep_value` method: {{{ RuntimeWarning: DateTimeField received a naive datetime (2012-11-17 16:08:44) while time zone support is active. }}} I have tracked the problem down to Django's MySQL cursor wrapper class, which applies alternative conversion functions for certain field types. The `parse_datetime_with_timezone_support` function ensures Python `datetime` objects always have a default `tzinfo` if time zone support is enabled. The `FIELD_TYPE.DATETIME` type gets handled by this function, however `FIELD_TYPE.TIMESTAMP` doesn't, and the naive `datetime` objects slip through and produce errors." Cleanup/optimization closed Documentation 1.4 Normal fixed mysql timezone timestamp datetime datetimefield Accepted 1 0 0 0 0 0