File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 3636import logging
3737from collections import OrderedDict
3838
39+ import django
3940from django import forms
4041from django .contrib .postgres .utils import prefix_validation_error
4142from django .utils .translation import ugettext as _
@@ -144,9 +145,11 @@ def clean(self, value):
144145 try :
145146 cleaned_data [name ] = field .clean (value .get (name ))
146147 except forms .ValidationError as error :
148+ prefix = '%(label)s:' if django .__version__ >= '2.1.0' \
149+ else '%(label)s: '
147150 errors .append (prefix_validation_error (
148151 error , code = 'field_invalid' ,
149- prefix = '%(label)s:' , params = {'label' : field .label }))
152+ prefix = prefix , params = {'label' : field .label }))
150153 if errors :
151154 raise forms .ValidationError (errors )
152155 value = self .model (** cleaned_data )
You can’t perform that action at this time.
0 commit comments