This is untested and incomplete:
class TimeFieldWithZone(TimeField): def db_type(self, connection): if (connection.settings_dict['ENGINE'] == 'django.db.backends.postgresql_psycopg2'): return 'time with time zone' raise Exception('Unsupported database type') def get_db_prep_value(self, value, *args, **kwargs): try: return super(TimeFieldWithZone, self).get_db_prep_value( value, *args, **kwargs) except ValueError: return six.text_type(value)
This will use the Postgres' time with time zone data type. It will break if you pass it a line in the format "HH: MM: SS.mmmmmm + HH: MM", and with the help of auto_now will try to save the naive time (not sure if this causes an error).
Edit
An exception is thrown in the common base code if you try to insert a time with a time zone other than UTC.
change 2
I added an updated get_db_prep_value to convert the provided time with the time zone to a string, but it only works if the provided time zone outputs the offset utc (which may be ambiguous without a date).
It seems that time with time zone bit misleading ... As far as I can tell, in fact it stores time with a UTC offset and NOT a time zone. Thus, it would be difficult to take the return value, add the calendar date and return to the correct time relative to daylight saving time.
source share