Django

Code

Changeset 9565

Show
Ignore:
Timestamp:
12/03/08 23:39:50 (1 month ago)
Author:
mtredinnick
Message:

[1.0.X] Fixed some markup errors in the form validation docs.

Backport of r9564 from trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/releases/1.0.X/docs/ref/forms/validation.txt

    r9259 r9565  
    6464      ``non_field_errors()`` method if you need to. If you want to attach 
    6565      errors to a specific field in the form, you will need to access the 
    66       `_errors` attribute on the form, which is `described later`_. 
     66      ``_errors`` attribute on the form, which is `described later`_. 
    6767 
    6868These methods are run in the order given above, one field at a time.  That is, 
     
    100100 
    101101When you really do need to attach the error to a particular field, you should 
    102 store (or amend) a key in the `Form._errors` attribute. This attribute is an 
     102store (or amend) a key in the ``Form._errors`` attribute. This attribute is an 
    103103instance of a ``django.forms.util.ErrorDict`` class. Essentially, though, it's 
    104104just a dictionary. There is a key in the dictionary for each field in the form 
    105105that has an error. Each value in the dictionary is a 
    106106``django.forms.util.ErrorList`` instance, which is a list that knows how to 
    107 display itself in different ways. So you can treat `_errors` as a dictionary 
     107display itself in different ways. So you can treat ``_errors`` as a dictionary 
    108108mapping field names to lists. 
    109109 
    110110If you want to add a new error to a particular field, you should check whether 
    111 the key already exists in `self._errors` or not. If not, create a new entry 
     111the key already exists in ``self._errors`` or not. If not, create a new entry 
    112112for the given key, holding an empty ``ErrorList`` instance. In either case, 
    113113you can then append your error message to the list for the field name in 
    114114question and it will be displayed when the form is displayed. 
    115115 
    116 There is an example of modifying `self._errors` in the following section. 
     116There is an example of modifying ``self._errors`` in the following section. 
    117117 
    118118.. admonition:: What's in a name?