1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields

This commit is contained in:
Loic Bistuer
2013-06-05 14:55:05 -04:00
committed by Tim Graham
parent f34cfec0fa
commit ee77d4b253
22 changed files with 403 additions and 149 deletions

View File

@@ -76,7 +76,7 @@ def validate_integer(value):
try:
int(value)
except (ValueError, TypeError):
raise ValidationError('')
raise ValidationError(_('Enter a valid integer.'), code='invalid')
class EmailValidator(object):
@@ -188,11 +188,7 @@ class BaseValidator(object):
cleaned = self.clean(value)
params = {'limit_value': self.limit_value, 'show_value': cleaned}
if self.compare(cleaned, self.limit_value):
raise ValidationError(
self.message % params,
code=self.code,
params=params,
)
raise ValidationError(self.message, code=self.code, params=params)
class MaxValueValidator(BaseValidator):