Ticket #16986: model-clean-errordict.diff

File model-clean-errordict.diff, 619 bytes (added by David Foster, 8 years ago)
  • django/forms/models.py

     
    330330        try:
    331331            self.instance.clean()
    332332        except ValidationError, e:
    333             self._update_errors({NON_FIELD_ERRORS: e.messages})
     333            if hasattr(e, 'message_dict'):
     334                self._update_errors(e.message_dict)
     335            else:
     336                self._update_errors({NON_FIELD_ERRORS: e.messages})
    334337
    335338        # Validate uniqueness if needed.
    336339        if self._validate_unique:
Back to Top