mirror of
https://github.com/django/django.git
synced 2025-08-01 17:42:56 +00:00
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:
parent
4decf03f9c
commit
7c53c2618d
2 changed files with 40 additions and 2 deletions
|
@ -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')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue