It's easy to change this line to
{{{
'TimeField': 'time with time zone'
}}}
which does work. But there is a problem:
I wanted to do a pull request so I changed the line. Now I had problems
with my migrations file, since I have one that alters a field from
TimeField (which was now "with time zone") to a interval. Postgres does
not like that and throws
{{{
django.db.utils.ProgrammingError: column "duration" cannot be cast
automatically to type interval
HINT: You might need to specify "USING duration::interval".
}}}
So I did that and executed, by hand:
{{{
ALTER TABLE "resource_check_testtyperesourcetype" ALTER COLUMN
"duration" TYPE interval USING duration::interval;
}}}
Now it says: '''ERROR: cannot cast type time with time zone to interval
at character 103'''
So now I'm not sure if it is even a good idea to change the default
behaviour of TimeField to "with time zone"....
--
Ticket URL: <https://code.djangoproject.com/ticket/26183>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
* resolution: => wontfix
Comment:
This is by design
[https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#naive-and-
aware-datetime-objects as documented]:
Python’s `datetime.time` objects also feature a `tzinfo` attribute, and
PostgreSQL has a matching `time with time zone type`. However, as
PostgreSQL’s docs put it, this type “exhibits properties which lead to
questionable usefulness”.
[[BR]]
Django only supports naive time objects and will raise an exception if
you attempt to save an aware time object, as a timezone for a time with no
associated date does not make sense.
--
Ticket URL: <https://code.djangoproject.com/ticket/26183#comment:1>
Comment (by schtibe):
Right, thank you for clarification.
--
Ticket URL: <https://code.djangoproject.com/ticket/26183#comment:2>