Fixed #2727 -- Fixed problem with serialising error messages from validation.
Thanks, Ivan Saglaev. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3816 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a6a4e9b244
commit
e0cec60a14
|
@ -2,7 +2,7 @@ from django.core import validators
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext, gettext_lazy, ngettext
|
from django.utils.translation import gettext, ngettext
|
||||||
|
|
||||||
FORM_FIELD_ID_PREFIX = 'id_'
|
FORM_FIELD_ID_PREFIX = 'id_'
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ class FormField(object):
|
||||||
def get_validation_errors(self, new_data):
|
def get_validation_errors(self, new_data):
|
||||||
errors = {}
|
errors = {}
|
||||||
if self.is_required and not new_data.get(self.field_name, False):
|
if self.is_required and not new_data.get(self.field_name, False):
|
||||||
errors.setdefault(self.field_name, []).append(gettext_lazy('This field is required.'))
|
errors.setdefault(self.field_name, []).append(gettext('This field is required.'))
|
||||||
return errors
|
return errors
|
||||||
try:
|
try:
|
||||||
for validator in self.validator_list:
|
for validator in self.validator_list:
|
||||||
|
|
Loading…
Reference in New Issue