Fixed #2443 -- Added DurationField.

A field for storing periods of time - modeled in Python by timedelta. It
is stored in the native interval data type on PostgreSQL and as a bigint
of microseconds on other backends.

Also includes significant changes to the internals of time related maths
in expressions, including the removal of DateModifierNode.

Thanks to Tim and Josh in particular for reviews.
This commit is contained in:
Marc Tamlyn 2014-07-24 13:57:24 +01:00
parent a3d96bee36
commit 57554442fe
26 changed files with 524 additions and 138 deletions

View file

@ -158,6 +158,15 @@ The functions defined in this module share the following properties:
``tzinfo`` attribute is a :class:`~django.utils.tzinfo.FixedOffset`
instance.
.. function:: parse_duration(value)
.. versionadded:: 1.8
Parses a string and returns a :class:`datetime.timedelta`.
Expects data in the format ``"DD HH:MM:SS.uuuuuu"`` or as specified by ISO
8601 (e.g. ``P4DT1H15M20S`` which is equivalent to ``4 1:15:20``).
``django.utils.decorators``
===========================