Ticket #9384: 9384.2.diff
File 9384.2.diff, 1.5 KB (added by , 16 years ago) |
---|
-
docs/ref/forms/validation.txt
100 100 101 101 When you really do need to attach the error to a particular field, you should 102 102 store (or amend) a key in the `Form._errors` attribute. This attribute is an 103 instance of a ``django.form .utils.ErrorDict`` class. Essentially, though, it's103 instance of a ``django.forms.util.ErrorDict`` class. Essentially, though, it's 104 104 just a dictionary. There is a key in the dictionary for each field in the form 105 105 that has an error. Each value in the dictionary is a 106 ``django.form .utils.ErrorList`` instance, which is a list that knows how to106 ``django.forms.util.ErrorList`` instance, which is a list that knows how to 107 107 display itself in different ways. So you can treat `_errors` as a dictionary 108 108 mapping field names to lists. 109 109 -
django/forms/fields.py
681 681 # a coercion function so that ModelForms with choices work. However, 682 682 # Django's Field.to_python raises django.core.exceptions.ValidationError, 683 683 # which is a *different* exception than 684 # django.forms.util s.ValidationError. So unfortunatly we need to catch684 # django.forms.util.ValidationError. So unfortunatly we need to catch 685 685 # both. 686 686 try: 687 687 value = self.coerce(value)