diff --git a/django/core/validators.py b/django/core/validators.py
index c7bda68..0a2cc2a 100644
a
|
b
|
except ImportError: # Python 2
|
7 | 7 | from urlparse import urlsplit, urlunsplit |
8 | 8 | |
9 | 9 | from django.core.exceptions import ValidationError |
10 | | from django.utils.translation import ugettext_lazy as _ |
| 10 | from django.utils.translation import ugettext_lazy as _, ungettext |
11 | 11 | from django.utils.encoding import force_text |
12 | 12 | from django.utils.ipv6 import is_valid_ipv6_address |
13 | 13 | from django.utils import six |
… |
… |
class MinValueValidator(BaseValidator):
|
186 | 186 | class MinLengthValidator(BaseValidator): |
187 | 187 | compare = lambda self, a, b: a < b |
188 | 188 | clean = lambda self, x: len(x) |
189 | | message = _('Ensure this value has at least %(limit_value)d characters (it has %(show_value)d).') |
190 | 189 | code = 'min_length' |
191 | 190 | |
| 191 | def __call__(self, value): |
| 192 | self.message = ungettext( |
| 193 | 'Ensure this value has at least %(limit_value)d character (it has %(show_value)d).', |
| 194 | 'Ensure this value has at least %(limit_value)d characters (it has %(show_value)d).', |
| 195 | self.limit_value |
| 196 | ) |
| 197 | super(MinLengthValidator, self).__call__(value) |
| 198 | |
192 | 199 | |
193 | 200 | class MaxLengthValidator(BaseValidator): |
194 | 201 | compare = lambda self, a, b: a > b |
195 | 202 | clean = lambda self, x: len(x) |
196 | | message = _('Ensure this value has at most %(limit_value)d characters (it has %(show_value)d).') |
197 | 203 | code = 'max_length' |
| 204 | |
| 205 | def __call__(self, value): |
| 206 | self.message = ungettext( |
| 207 | 'Ensure this value has at most %(limit_value)d character (it has %(show_value)d).', |
| 208 | 'Ensure this value has at most %(limit_value)d characters (it has %(show_value)d).', |
| 209 | self.limit_value |
| 210 | ) |
| 211 | super(MaxLengthValidator, self).__call__(value) |