More specific exception error message
This commit is contained in:
parent
3eb0e8fc57
commit
ecd1abf8b1
|
@ -32,7 +32,7 @@ class NrnField(forms.CharField):
|
|||
if (97 - int(value[:9]) % 97) != int(value[-2:]):
|
||||
raise ValueError()
|
||||
except ValueError:
|
||||
raise forms.ValidationError(_('Invalid Format'))
|
||||
raise forms.ValidationError(_('National number : Invalid Format'))
|
||||
|
||||
|
||||
class DateWidget(forms.TextInput):
|
||||
|
@ -63,7 +63,7 @@ class DateField(forms.CharField):
|
|||
continue
|
||||
break
|
||||
else:
|
||||
raise forms.ValidationError(_('Invalid Date Format'))
|
||||
raise forms.ValidationError(_('Birthdate : Invalid Format'))
|
||||
|
||||
|
||||
class StreetWidget(forms.TextInput):
|
||||
|
@ -122,7 +122,7 @@ class NumHouseField(forms.CharField):
|
|||
if not re.match("^[1-9][0-9]*$", value):
|
||||
raise ValueError()
|
||||
except ValueError:
|
||||
raise forms.ValidationError(getattr(settings, 'A2_NUMHOUSE_ERROR_MESSAGE', _('Invalid Format')))
|
||||
raise forms.ValidationError(getattr(settings, 'A2_NUMHOUSE_ERROR_MESSAGE', _('House number : invalid format')))
|
||||
|
||||
|
||||
class NumPhoneField(forms.CharField):
|
||||
|
@ -134,4 +134,4 @@ class NumPhoneField(forms.CharField):
|
|||
if not re.match("^(0|\\+|00)(\d{8,})", value):
|
||||
raise ValueError()
|
||||
except ValueError:
|
||||
raise forms.ValidationError(getattr(settings, 'A2_NUMPHONE_ERROR_MESSAGE', _('Invalid Format')))
|
||||
raise forms.ValidationError(getattr(settings, 'A2_NUMPHONE_ERROR_MESSAGE', _('Phone number : Invalid Format')))
|
||||
|
|
Loading…
Reference in New Issue