mirror of
https://github.com/django/django.git
synced 2025-10-06 16:50:52 +00:00
Refs #32339 -- Added use_fieldset to Widget.
This commit is contained in:
parent
04ad0f26ba
commit
c8459708a7
28 changed files with 489 additions and 22 deletions
|
@ -686,6 +686,32 @@ Useful attributes on ``{{ field }}`` include:
|
|||
|
||||
<label for="id_email">Email address:</label>
|
||||
|
||||
``{{ field.legend_tag }}``
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
Similar to ``field.label_tag`` but uses a ``<legend>`` tag in place of
|
||||
``<label>``, for widgets with multiple inputs wrapped in a ``<fieldset>``.
|
||||
|
||||
``{{ field.use_fieldset }}``
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
This attribute is ``True`` if the form field's widget contains multiple
|
||||
inputs that should be semantically grouped in a ``<fieldset>`` with a
|
||||
``<legend>`` to improve accessibility. An example use in a template:
|
||||
|
||||
.. code-block:: html+django
|
||||
|
||||
{% if field.use_fieldset %}
|
||||
<fieldset>
|
||||
{% if field.label %}{{ field.legend_tag }}{% endif %}
|
||||
{% else %}
|
||||
{% if field.label %}{{ field.label_tag }}{% endif %}
|
||||
{% endif %}
|
||||
{{ field }}
|
||||
{% if field.use_fieldset %}</fieldset>{% endif %}
|
||||
|
||||
``{{ field.value }}``
|
||||
The value of the field. e.g ``someone@example.com``.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue