From 57554442fe3e209c135e15dda4ea45123e579e58 Mon Sep 17 00:00:00 2001 From: Marc Tamlyn Date: Thu, 24 Jul 2014 13:57:24 +0100 Subject: 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. --- docs/ref/forms/fields.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs/ref/forms') diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 0f13adc249..b63826d9b1 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -546,6 +546,23 @@ For each field, we describe the default widget used if you don't specify The maximum number of decimal places permitted. +``DurationField`` +~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.8 + +.. class:: DurationField(**kwargs) + + * Default widget: :class:`TextInput` + * Empty value: ``None`` + * Normalizes to: A Python :class:`~python:datetime.timedelta`. + * Validates that the given value is a string which can be converted into a + ``timedelta``. + * Error message keys: ``required``, ``invalid``. + + Accepts any format understood by + :func:`~django.utils.dateparse.parse_duration`. + ``EmailField`` ~~~~~~~~~~~~~~ -- cgit v1.3