Author: Honza_Kral Date: 2009-06-17 19:58:39 -0500 (Wed, 17 Jun 2009) New Revision: 11036
Modified: django/branches/soc2009/model-validation/django/forms/forms.py Log: [soc2009/model-validation] have complex validators also use error_messages if applicable Modified: django/branches/soc2009/model-validation/django/forms/forms.py =================================================================== --- django/branches/soc2009/model-validation/django/forms/forms.py 2009-06-18 00:31:57 UTC (rev 11035) +++ django/branches/soc2009/model-validation/django/forms/forms.py 2009-06-18 00:58:39 UTC (rev 11036) @@ -261,7 +261,11 @@ try: v(self.cleaned_data[name], all_values=self.cleaned_data) except ValidationError, e: - self._errors.setdefault(name, self.error_class()).extend(e.messages) + error_list = self._errors.setdefault(name, self.error_class()) + if hasattr(e, 'code'): + error_list.append(field.error_messages.get(e.code, e.messages[0])) + else: + error_list.extend(e.messages) if name in self.cleaned_data: del self.cleaned_data[name] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---