diff options
| author | Karen Tracey <kmtracey@gmail.com> | 2009-03-22 16:13:06 +0000 |
|---|---|---|
| committer | Karen Tracey <kmtracey@gmail.com> | 2009-03-22 16:13:06 +0000 |
| commit | 14b160957e2965669e241f4640dd42a0fc412ec4 (patch) | |
| tree | 9069f7bb839ca154f851515ad3e08b86841c03b3 /docs/ref/forms | |
| parent | b203db6ec850fee9ad8f2e2c8873be986325572b (diff) | |
Fixed #8962 -- Consistently support format and input_format in the various (individual, combined, split) date and time form fields and widgets.
Many thanks to Tai Lee for doing all the work here.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10115 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref/forms')
| -rw-r--r-- | docs/ref/forms/fields.txt | 36 | ||||
| -rw-r--r-- | docs/ref/forms/widgets.txt | 48 |
2 files changed, 81 insertions, 3 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 2f40b6f539..4248af3d26 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -398,7 +398,7 @@ Takes extra arguments: .. class:: DateField(**kwargs) - * Default widget: ``TextInput`` + * Default widget: ``DateInput`` * Empty value: ``None`` * Normalizes to: A Python ``datetime.date`` object. * Validates that the given value is either a ``datetime.date``, @@ -420,6 +420,10 @@ If no ``input_formats`` argument is provided, the default input formats are:: '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006' +.. versionchanged:: 1.1 + The ``DateField`` previously used a ``TextInput`` widget by default. It now + uses a ``DateInput`` widget. + ``DateTimeField`` ~~~~~~~~~~~~~~~~~ @@ -739,6 +743,36 @@ The following are not yet documented. .. class:: SplitDateTimeField(**kwargs) + * Default widget: ``SplitDateTimeWidget`` + * Empty value: ``None`` + * Normalizes to: A Python ``datetime.datetime`` object. + * Validates that the given value is a ``datetime.datetime`` or string + formatted in a particular datetime format. + * Error message keys: ``required``, ``invalid`` + +Takes two optional arguments: + +.. attribute:: SplitDateTimeField.input_date_formats + + A list of formats used to attempt to convert a string to a valid + ``datetime.date`` object. + +If no ``input_date_formats`` argument is provided, the default input formats +for ``DateField`` are used. + +.. attribute:: SplitDateTimeField.input_time_formats + + A list of formats used to attempt to convert a string to a valid + ``datetime.time`` object. + +If no ``input_time_formats`` argument is provided, the default input formats +for ``TimeField`` are used. + +.. versionchanged:: 1.1 + The ``SplitDateTimeField`` previously used two ``TextInput`` widgets by + default. The ``input_date_formats`` and ``input_time_formats`` arguments + are also new. + Fields which handle relationships --------------------------------- diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index 364e664fc1..232a2acf0b 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -36,12 +36,49 @@ commonly used groups of widgets: File upload input: ``<input type='file' ...>`` +.. class:: DateInput + + .. versionadded:: 1.1 + + Date input as a simple text box: ``<input type='text' ...>`` + + Takes one optional argument: + + .. attribute:: DateInput.format + + The format in which this field's initial value will be displayed. + + If no ``format`` argument is provided, the default format is ``'%Y-%m-%d'``. + .. class:: DateTimeInput .. versionadded:: 1.0 Date/time input as a simple text box: ``<input type='text' ...>`` + Takes one optional argument: + + .. attribute:: DateTimeInput.format + + The format in which this field's initial value will be displayed. + + If no ``format`` argument is provided, the default format is ``'%Y-%m-%d %H:%M:%S'``. + +.. class:: TimeInput + + Time input as a simple text box: ``<input type='text' ...>`` + + Takes one optional argument: + + .. attribute:: TimeInput.format + + The format in which this field's initial value will be displayed. + + If no ``format`` argument is provided, the default format is ``'%H:%M:%S'``. + + .. versionchanged:: 1.1 + The ``format`` argument was not supported in Django 1.0. + .. class:: Textarea Text area: ``<textarea>...</textarea>`` @@ -91,8 +128,15 @@ commonly used groups of widgets: .. class:: SplitDateTimeWidget - Wrapper around two ``TextInput`` widgets: one for the date, and one for the - time. + Wrapper around two widgets: ``DateInput`` for the date, and ``TimeInput`` + for the time. + + Takes two optional arguments, ``date_format`` and ``time_format``, which + work just like the ``format`` argument for ``DateInput`` and ``TimeInput``. + + .. versionchanged:: 1.1 + The ``date_format`` and ``time_format`` arguments were not supported in Django 1.0. + Specifying widgets ------------------ |
