Ticket #14860: 14860.diff

File 14860.diff, 1.5 KB (added by Idan Gazit, 14 years ago)
  • django/contrib/localflavor/pl/forms.py

    diff --git a/django/contrib/localflavor/pl/forms.py b/django/contrib/localflavor/pl/forms.py
    index b908580..d1e9773 100644
    a b import re  
    77from django.forms import ValidationError
    88from django.forms.fields import Select, RegexField
    99from django.utils.translation import ugettext_lazy as _
     10from django.core.validators import EMPTY_VALUES
    1011
    1112class PLProvinceSelect(Select):
    1213    """
    class PLPESELField(RegexField):  
    4546
    4647    def clean(self,value):
    4748        super(PLPESELField, self).clean(value)
     49        if value in EMPTY_VALUES:
     50            return u''
    4851        if not self.has_valid_checksum(value):
    4952            raise ValidationError(self.error_messages['checksum'])
    5053        return u'%s' % value
    class PLNIPField(RegexField):  
    7881
    7982    def clean(self,value):
    8083        super(PLNIPField, self).clean(value)
     84        if value in EMPTY_VALUES:
     85            return u''
    8186        value = re.sub("[-]", "", value)
    8287        if not self.has_valid_checksum(value):
    8388            raise ValidationError(self.error_messages['checksum'])
    class PLREGONField(RegexField):  
    116121
    117122    def clean(self,value):
    118123        super(PLREGONField, self).clean(value)
     124        if value in EMPTY_VALUES:
     125            return u''
    119126        if not self.has_valid_checksum(value):
    120127            raise ValidationError(self.error_messages['checksum'])
    121128        return u'%s' % value
Back to Top