Fixed #16602 - Added forms.widgets TOC links to docs; thanks kencochrane.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16633 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Timo Graham 2011-08-21 11:51:48 +00:00
parent ec530b1425
commit 24a45a5fda
1 changed files with 61 additions and 0 deletions

View File

@ -171,6 +171,9 @@ Built-in widgets
Django provides a representation of all the basic HTML widgets, plus some Django provides a representation of all the basic HTML widgets, plus some
commonly used groups of widgets: commonly used groups of widgets:
``Widget``
~~~~~~~~~~
.. class:: Widget .. class:: Widget
This abstract class cannot be rendered, but provides the basic attribute :attr:`~Widget.attrs`. This abstract class cannot be rendered, but provides the basic attribute :attr:`~Widget.attrs`.
@ -185,11 +188,16 @@ commonly used groups of widgets:
>>> name.render('name', 'A name') >>> name.render('name', 'A name')
u'<input title="Your name" type="text" name="name" value="A name" size="10" />' u'<input title="Your name" type="text" name="name" value="A name" size="10" />'
``TextInput``
~~~~~~~~~~~~~
.. class:: TextInput .. class:: TextInput
Text input: ``<input type='text' ...>`` Text input: ``<input type='text' ...>``
``PasswordInput``
~~~~~~~~~~~~~~~~~
.. class:: PasswordInput .. class:: PasswordInput
Password input: ``<input type='password' ...>`` Password input: ``<input type='password' ...>``
@ -206,10 +214,16 @@ commonly used groups of widgets:
:attr:`~PasswordInput.render_value` was :attr:`~PasswordInput.render_value` was
changed from ``True`` to ``False`` changed from ``True`` to ``False``
``HiddenInput``
~~~~~~~~~~~~~~~
.. class:: HiddenInput .. class:: HiddenInput
Hidden input: ``<input type='hidden' ...>`` Hidden input: ``<input type='hidden' ...>``
``MultipleHiddenInput``
~~~~~~~~~~~~~~~~~~~~~~~
.. class:: MultipleHiddenInput .. class:: MultipleHiddenInput
Multiple ``<input type='hidden' ...>`` widgets. Multiple ``<input type='hidden' ...>`` widgets.
@ -223,10 +237,16 @@ commonly used groups of widgets:
:attr:`~Field.choices` attribute. If it does, it will override anything :attr:`~Field.choices` attribute. If it does, it will override anything
you set here when the attribute is updated on the :class:`Field`. you set here when the attribute is updated on the :class:`Field`.
``FileInput``
~~~~~~~~~~~~~
.. class:: FileInput .. class:: FileInput
File upload input: ``<input type='file' ...>`` File upload input: ``<input type='file' ...>``
``ClearableFileInput``
~~~~~~~~~~~~~~~~~~~~~~
.. class:: ClearableFileInput .. class:: ClearableFileInput
.. versionadded:: 1.3 .. versionadded:: 1.3
@ -235,6 +255,9 @@ commonly used groups of widgets:
input to clear the field's value, if the field is not required and has input to clear the field's value, if the field is not required and has
initial data. initial data.
``DateInput``
~~~~~~~~~~~~~
.. class:: DateInput .. class:: DateInput
Date input as a simple text box: ``<input type='text' ...>`` Date input as a simple text box: ``<input type='text' ...>``
@ -249,6 +272,9 @@ commonly used groups of widgets:
format found in :setting:`DATE_INPUT_FORMATS` and respects format found in :setting:`DATE_INPUT_FORMATS` and respects
:ref:`format-localization`. :ref:`format-localization`.
``DateTimeInput``
~~~~~~~~~~~~~~~~~
.. class:: DateTimeInput .. class:: DateTimeInput
Date/time input as a simple text box: ``<input type='text' ...>`` Date/time input as a simple text box: ``<input type='text' ...>``
@ -263,6 +289,9 @@ commonly used groups of widgets:
format found in :setting:`DATETIME_INPUT_FORMATS` and respects format found in :setting:`DATETIME_INPUT_FORMATS` and respects
:ref:`format-localization`. :ref:`format-localization`.
``TimeInput``
~~~~~~~~~~~~~
.. class:: TimeInput .. class:: TimeInput
Time input as a simple text box: ``<input type='text' ...>`` Time input as a simple text box: ``<input type='text' ...>``
@ -277,10 +306,16 @@ commonly used groups of widgets:
format found in :setting:`TIME_INPUT_FORMATS` and respects format found in :setting:`TIME_INPUT_FORMATS` and respects
:ref:`format-localization`. :ref:`format-localization`.
``Textarea``
~~~~~~~~~~~~
.. class:: Textarea .. class:: Textarea
Text area: ``<textarea>...</textarea>`` Text area: ``<textarea>...</textarea>``
``CheckboxInput``
~~~~~~~~~~~~~~~~~
.. class:: CheckboxInput .. class:: CheckboxInput
Checkbox: ``<input type='checkbox' ...>`` Checkbox: ``<input type='checkbox' ...>``
@ -292,6 +327,9 @@ commonly used groups of widgets:
A callable that takes the value of the CheckBoxInput and returns A callable that takes the value of the CheckBoxInput and returns
``True`` if the checkbox should be checked for that value. ``True`` if the checkbox should be checked for that value.
``Select``
~~~~~~~~~~
.. class:: Select .. class:: Select
Select widget: ``<select><option ...>...</select>`` Select widget: ``<select><option ...>...</select>``
@ -302,15 +340,24 @@ commonly used groups of widgets:
:attr:`~Field.choices` attribute. If it does, it will override anything :attr:`~Field.choices` attribute. If it does, it will override anything
you set here when the attribute is updated on the :class:`Field`. you set here when the attribute is updated on the :class:`Field`.
``NullBooleanSelect``
~~~~~~~~~~~~~~~~~~~~~
.. class:: NullBooleanSelect .. class:: NullBooleanSelect
Select widget with options 'Unknown', 'Yes' and 'No' Select widget with options 'Unknown', 'Yes' and 'No'
``SelectMultiple``
~~~~~~~~~~~~~~~~~~
.. class:: SelectMultiple .. class:: SelectMultiple
Similar to :class:`Select`, but allows multiple selection: Similar to :class:`Select`, but allows multiple selection:
``<select multiple='multiple'>...</select>`` ``<select multiple='multiple'>...</select>``
``RadioSelect``
~~~~~~~~~~~~~~~
.. class:: RadioSelect .. class:: RadioSelect
Similar to :class:`Select`, but rendered as a list of radio buttons: Similar to :class:`Select`, but rendered as a list of radio buttons:
@ -322,6 +369,9 @@ commonly used groups of widgets:
... ...
</ul> </ul>
``CheckboxSelectMultiple``
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. class:: CheckboxSelectMultiple .. class:: CheckboxSelectMultiple
Similar to :class:`SelectMultiple`, but rendered as a list of check Similar to :class:`SelectMultiple`, but rendered as a list of check
@ -334,6 +384,9 @@ commonly used groups of widgets:
... ...
</ul> </ul>
``MultiWidget``
~~~~~~~~~~~~~~~
.. class:: MultiWidget .. class:: MultiWidget
Wrapper around multiple other widgets. You'll probably want to use this Wrapper around multiple other widgets. You'll probably want to use this
@ -381,6 +434,9 @@ commonly used groups of widgets:
An iterable containing the widgets needed. An iterable containing the widgets needed.
``SplitDateTimeWidget``
~~~~~~~~~~~~~~~~~~~~~~~
.. class:: SplitDateTimeWidget .. class:: SplitDateTimeWidget
Wrapper (using :class:`MultiWidget`) around two widgets: :class:`DateInput` Wrapper (using :class:`MultiWidget`) around two widgets: :class:`DateInput`
@ -396,6 +452,8 @@ commonly used groups of widgets:
Similar to :attr:`TimeInput.format` Similar to :attr:`TimeInput.format`
``SplitHiddenDateTimeWidget``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. class:: SplitHiddenDateTimeWidget .. class:: SplitHiddenDateTimeWidget
@ -404,6 +462,9 @@ commonly used groups of widgets:
.. currentmodule:: django.forms.extras.widgets .. currentmodule:: django.forms.extras.widgets
``SelectDateWidget``
~~~~~~~~~~~~~~~~~~~~
.. class:: SelectDateWidget .. class:: SelectDateWidget
Wrapper around three :class:`~django.forms.Select` widgets: one each for Wrapper around three :class:`~django.forms.Select` widgets: one each for