mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #14750 -- ILPostalCodeField didn't handle all EMPTY_VALUES correctly. Also converted the Israeli localflavor testcases to use the new, less verbose format. Thanks to Idan Gazit.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14943 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -4,6 +4,7 @@ Israeli-specific form helpers
|
||||
import re
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import EMPTY_VALUES
|
||||
from django.forms.fields import RegexField, Field, EMPTY_VALUES
|
||||
from django.utils.checksums import luhn
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
@@ -34,7 +35,7 @@ class ILPostalCodeField(RegexField):
|
||||
super(ILPostalCodeField, self).__init__(r'^\d{5}$', *args, **kwargs)
|
||||
|
||||
def clean(self, value):
|
||||
if value is not None:
|
||||
if value not in EMPTY_VALUES:
|
||||
value = value.replace(" ", "")
|
||||
return super(ILPostalCodeField, self).clean(value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user