1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #32339 -- Added div.html form template.

This commit is contained in:
David Smith
2022-05-05 09:21:47 +02:00
committed by Carlton Gibson
parent 27b07a3246
commit ec5659382a
13 changed files with 328 additions and 6 deletions

View File

@@ -258,6 +258,15 @@ Forms
:attr:`~django.forms.renderers.BaseRenderer.formset_template_name` renderer
attribute.
* The new ``div.html`` form template, referencing
:attr:`.Form.template_name_div` attribute, and matching :meth:`.Form.as_div`
method, render forms using HTML ``<div>`` elements.
This new output style is recommended over the existing
:meth:`~.Form.as_table`, :meth:`~.Form.as_p` and :meth:`~.Form.as_ul` styles,
as the template implements ``<fieldset>`` and ``<legend>`` to group related
inputs and is easier for screen reader users to navigate.
* The new :meth:`~django.forms.BoundField.legend_tag` allows rendering field
labels in ``<legend>`` tags via the new ``tag`` argument of
:meth:`~django.forms.BoundField.label_tag`.