From 10f7cfeb2df35c5f7775d59c9d654952971897fb Mon Sep 17 00:00:00 2001 From: wdmgsm Date: Sun, 22 Mar 2015 13:27:01 +0000 Subject: [PATCH] Fixed #24520 -- Documented Widget.supports_microseconds --- docs/ref/forms/widgets.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index 2260986ee1a..bb0779f550c 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -217,6 +217,17 @@ foundation for custom widgets. >>> name.render('name', 'A name') '' + .. attribute:: Widget.supports_microseconds + + An attribute that defaults to ``True``. If set to ``False``, the + microseconds part of :class:`~datetime.datetime` and + :class:`~datetime.time` values will be set to ``0``. + + .. versionadded:: 1.9 + + In older versions, this attribute was only defined on the date + and time widgets (as ``False``). + .. method:: render(name, value, attrs=None) Returns HTML for the widget, as a Unicode string. This method must be @@ -491,6 +502,10 @@ These widgets make use of the HTML elements ``input`` and ``textarea``. format found in :setting:`DATETIME_INPUT_FORMATS` and respects :ref:`format-localization`. + By default, the microseconds part of the time value is always set to ``0``. + If microseconds are required, use a subclass with the + :attr:`~Widget.supports_microseconds` attribute set to ``True``. + ``TimeInput`` ~~~~~~~~~~~~~ @@ -508,6 +523,8 @@ These widgets make use of the HTML elements ``input`` and ``textarea``. format found in :setting:`TIME_INPUT_FORMATS` and respects :ref:`format-localization`. + For the treatment of microseconds, see :class:`DateTimeInput`. + ``Textarea`` ~~~~~~~~~~~~