diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2010-12-18 20:31:22 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2010-12-18 20:31:22 +0000 |
| commit | 6a362d368411052ca8d3f0058d82b657eae846f5 (patch) | |
| tree | c5f09afe6bbd39e78eb33cfc3c84d0f004c21629 /django | |
| parent | b5ac6956a626e9a057628e6205547d070ca03f02 (diff) | |
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
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/localflavor/il/forms.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/contrib/localflavor/il/forms.py b/django/contrib/localflavor/il/forms.py index bbf95d2eed..a14358737e 100644 --- a/django/contrib/localflavor/il/forms.py +++ b/django/contrib/localflavor/il/forms.py @@ -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) |
