mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #11776 -- Added CSS class for non-field/top of form errors.
Thanks Daniel Pope for the suggestion.
This commit is contained in:
parent
a00efa30d6
commit
11f0899bbe
10 changed files with 120 additions and 17 deletions
|
@ -129,6 +129,10 @@ Forms
|
|||
the ``<label>`` tags for required fields will have this class present in its
|
||||
attributes.
|
||||
|
||||
* The rendering of non-field errors in unordered lists (``<ul>``) now includes
|
||||
``nonfield`` in its list of classes to distinguish them from field-specific
|
||||
errors.
|
||||
|
||||
* :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
|
||||
|
|
|
@ -292,6 +292,17 @@ over them::
|
|||
</ol>
|
||||
{% endif %}
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
Non-field errors (and/or hidden field errors that are rendered at the top of
|
||||
the form when using helpers like ``form.as_p()``) will be rendered with an
|
||||
additional class of ``nonfield`` to help distinguish them from field-specific
|
||||
errors. For example, ``{{ form.non_field_errors }}`` would look like::
|
||||
|
||||
<ul class="errorlist nonfield">
|
||||
<li>Generic validation error</li>
|
||||
</ul>
|
||||
|
||||
Looping over the form's fields
|
||||
------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue