mirror of
https://github.com/django/django.git
synced 2025-03-23 07:40:44 +00:00
[1.11.x] Fixed #27918 -- Documented ChoiceWidget.option_template_name
Backport of 0d83052e52ddfe99c214be7ffca348a3c8feaef5 from master
This commit is contained in:
parent
1ed4dab20f
commit
3c1ed1d336
@ -621,6 +621,14 @@ These widgets make use of the HTML elements ``input`` and ``textarea``.
|
|||||||
Selector and checkbox widgets
|
Selector and checkbox widgets
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
These widgets make use of the HTML elements ``<select>``,
|
||||||
|
``<input type='checkbox'>``, and ``<input type='radio'>``.
|
||||||
|
|
||||||
|
Widgets that render multiple choices have an ``option_template_name`` attribute
|
||||||
|
that specifies the template used to render each choice. For example, for the
|
||||||
|
:class:`Select` widget, ``select_option.html`` renders the ``<option>`` for a
|
||||||
|
``<select>``.
|
||||||
|
|
||||||
``CheckboxInput``
|
``CheckboxInput``
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -643,6 +651,7 @@ Selector and checkbox widgets
|
|||||||
.. class:: Select
|
.. class:: Select
|
||||||
|
|
||||||
* ``template_name``: ``'django/forms/widgets/select.html'``
|
* ``template_name``: ``'django/forms/widgets/select.html'``
|
||||||
|
* ``option_template_name``: ``'django/forms/widgets/select_option.html'``
|
||||||
* Renders as: ``<select><option ...>...</select>``
|
* Renders as: ``<select><option ...>...</select>``
|
||||||
|
|
||||||
.. attribute:: Select.choices
|
.. attribute:: Select.choices
|
||||||
@ -657,6 +666,7 @@ Selector and checkbox widgets
|
|||||||
.. class:: NullBooleanSelect
|
.. class:: NullBooleanSelect
|
||||||
|
|
||||||
* ``template_name``: ``'django/forms/widgets/select.html'``
|
* ``template_name``: ``'django/forms/widgets/select.html'``
|
||||||
|
* ``option_template_name``: ``'django/forms/widgets/select_option.html'``
|
||||||
|
|
||||||
Select widget with options 'Unknown', 'Yes' and 'No'
|
Select widget with options 'Unknown', 'Yes' and 'No'
|
||||||
|
|
||||||
@ -666,6 +676,7 @@ Selector and checkbox widgets
|
|||||||
.. class:: SelectMultiple
|
.. class:: SelectMultiple
|
||||||
|
|
||||||
* ``template_name``: ``'django/forms/widgets/select.html'``
|
* ``template_name``: ``'django/forms/widgets/select.html'``
|
||||||
|
* ``option_template_name``: ``'django/forms/widgets/select_option.html'``
|
||||||
|
|
||||||
Similar to :class:`Select`, but allows multiple selection:
|
Similar to :class:`Select`, but allows multiple selection:
|
||||||
``<select multiple='multiple'>...</select>``
|
``<select multiple='multiple'>...</select>``
|
||||||
@ -676,6 +687,7 @@ Selector and checkbox widgets
|
|||||||
.. class:: RadioSelect
|
.. class:: RadioSelect
|
||||||
|
|
||||||
* ``template_name``: ``'django/forms/widgets/radio.html'``
|
* ``template_name``: ``'django/forms/widgets/radio.html'``
|
||||||
|
* ``option_template_name``: ``'django/forms/widgets/radio_option.html'``
|
||||||
|
|
||||||
Similar to :class:`Select`, but rendered as a list of radio buttons within
|
Similar to :class:`Select`, but rendered as a list of radio buttons within
|
||||||
``<li>`` tags:
|
``<li>`` tags:
|
||||||
@ -770,6 +782,7 @@ Selector and checkbox widgets
|
|||||||
.. class:: CheckboxSelectMultiple
|
.. class:: CheckboxSelectMultiple
|
||||||
|
|
||||||
* ``template_name``: ``'django/forms/widgets/checkbox_select.html'``
|
* ``template_name``: ``'django/forms/widgets/checkbox_select.html'``
|
||||||
|
* ``option_template_name``: ``'django/forms/widgets/checkbox_option.html'``
|
||||||
|
|
||||||
Similar to :class:`SelectMultiple`, but rendered as a list of check
|
Similar to :class:`SelectMultiple`, but rendered as a list of check
|
||||||
buttons:
|
buttons:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user