mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #17627 -- Renamed util.py files to utils.py
Thanks PaulM for the suggestion and Luke Granger-Brown and Wiktor Kołodziej for the initial patch.
This commit is contained in:
parent
8d29005524
commit
18ffdb1772
58 changed files with 111 additions and 84 deletions
|
@ -571,12 +571,12 @@ method you're using::
|
|||
Customizing the error list format
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
By default, forms use ``django.forms.util.ErrorList`` to format validation
|
||||
By default, forms use ``django.forms.utils.ErrorList`` to format validation
|
||||
errors. If you'd like to use an alternate class for displaying errors, you can
|
||||
pass that in at construction time (replace ``__unicode__`` by ``__str__`` on
|
||||
Python 3)::
|
||||
|
||||
>>> from django.forms.util import ErrorList
|
||||
>>> from django.forms.utils import ErrorList
|
||||
>>> class DivErrorList(ErrorList):
|
||||
... def __unicode__(self):
|
||||
... return self.as_divs()
|
||||
|
@ -592,6 +592,10 @@ Python 3)::
|
|||
<p>Sender: <input type="email" name="sender" value="invalid email address" /></p>
|
||||
<p>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></p>
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
``django.forms.util`` was renamed to ``django.forms.utils``.
|
||||
|
||||
More granular output
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -219,10 +219,10 @@ through the ``Form.non_field_errors()`` method.
|
|||
|
||||
When you really do need to attach the error to a particular field, you should
|
||||
store (or amend) a key in the ``Form._errors`` attribute. This attribute is an
|
||||
instance of a ``django.forms.util.ErrorDict`` class. Essentially, though, it's
|
||||
instance of a ``django.forms.utils.ErrorDict`` class. Essentially, though, it's
|
||||
just a dictionary. There is a key in the dictionary for each field in the form
|
||||
that has an error. Each value in the dictionary is a
|
||||
``django.forms.util.ErrorList`` instance, which is a list that knows how to
|
||||
``django.forms.utils.ErrorList`` instance, which is a list that knows how to
|
||||
display itself in different ways. So you can treat ``_errors`` as a dictionary
|
||||
mapping field names to lists.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue