Fixed #12001 -- Modified the example of form validation to use the form's error class, rather than assuming ErrorList. Thanks to Suor for the report, and timo for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13221 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2010-05-10 14:06:09 +00:00
parent a0cf7f4bb9
commit bc82e20370
1 changed files with 2 additions and 4 deletions

View File

@ -326,8 +326,6 @@ here and leaving it up to you and your designers to work out what works
effectively in your particular situation. Our new code (replacing the previous effectively in your particular situation. Our new code (replacing the previous
sample) looks like this:: sample) looks like this::
from django.forms.util import ErrorList
class ContactForm(forms.Form): class ContactForm(forms.Form):
# Everything as before. # Everything as before.
... ...
@ -341,8 +339,8 @@ sample) looks like this::
# We know these are not in self._errors now (see discussion # We know these are not in self._errors now (see discussion
# below). # below).
msg = u"Must put 'help' in subject when cc'ing yourself." msg = u"Must put 'help' in subject when cc'ing yourself."
self._errors["cc_myself"] = ErrorList([msg]) self._errors["cc_myself"] = self.error_class([msg])
self._errors["subject"] = ErrorList([msg]) self._errors["subject"] = self.error_class([msg])
# These fields are no longer valid. Remove them from the # These fields are no longer valid. Remove them from the
# cleaned data. # cleaned data.