1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #12698. Model.clean() used with a ModelForm no longer causes a KeyError when raising a ValidationError.

Note that previously it was possible to raise a ValidationError in the same place with a message_dict attribute. That behavior was a bug and will no longer have the same behavior.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12402 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans
2010-02-10 00:34:45 +00:00
parent 4682d693c4
commit 8f4540b2e6
3 changed files with 27 additions and 4 deletions

View File

@@ -317,7 +317,7 @@ class BaseModelForm(BaseForm):
try:
self.instance.clean()
except ValidationError, e:
self._update_errors(e.message_dict)
self._update_errors({NON_FIELD_ERRORS: e.messages})
super(BaseModelForm, self)._clean_form()
def validate_unique(self):