Fixed #10968 - Form.errors should use Form.error_class.

Thanks for report and initial patch, matehat.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@11498 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant 2009-09-11 10:47:40 +00:00
parent 4decf03f9c
commit 7c53c2618d
2 changed files with 40 additions and 2 deletions

View file

@ -243,13 +243,13 @@ class BaseForm(StrAndUnicode):
value = getattr(self, 'clean_%s' % name)()
self.cleaned_data[name] = value
except ValidationError, e:
self._errors[name] = e.messages
self._errors[name] = self.error_class(e.messages)
if name in self.cleaned_data:
del self.cleaned_data[name]
try:
self.cleaned_data = self.clean()
except ValidationError, e:
self._errors[NON_FIELD_ERRORS] = e.messages
self._errors[NON_FIELD_ERRORS] = self.error_class(e.messages)
if self._errors:
delattr(self, 'cleaned_data')