mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #22533 -- Added label_suffix parameter to form fields.
Fields can now receive the `label_suffix` attribute, which will override
a form's `label_suffix`.
This enhances the possibility to customize form's `label_suffix`, allowing
to use such customizations while using shortcuts such as
`{{ form.as_p }}`.
Note that the field's own customization can be overridden at runtime by
using the `label_prefix` parameter to `BoundField.label_tag()`.
Refs #18134.
This commit is contained in:
committed by
Tim Graham
parent
f2a8e47cfd
commit
5eb81ce445
@@ -118,6 +118,13 @@ Forms
|
||||
the ``<label>`` tags for required fields will have this class present in its
|
||||
attributes.
|
||||
|
||||
* :class:`~django.forms.Field` now accepts a
|
||||
:attr:`~django.forms.Field.label_suffix` argument, which will override the
|
||||
form's :attr:`~django.forms.Form.label_suffix`. This enables customizing the
|
||||
suffix on a per-field basis — previously it wasn't possible to override
|
||||
a form's :attr:`~django.forms.Form.label_suffix` while using shortcuts such
|
||||
as ``{{ form.as_p }}`` in templates.
|
||||
|
||||
Internationalization
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
Reference in New Issue
Block a user