Ticket #11577: plnipfield.patch

File plnipfield.patch, 727 bytes (added by amz, 6 years ago)
  • contrib/localflavor/pl/forms.py

     
    7878
    7979    def clean(self,value):
    8080        super(PLNIPField, self).clean(value)
    81         value = re.sub("[-]", "", value)
    82         if not self.has_valid_checksum(value):
    83             raise ValidationError(self.error_messages['checksum'])
     81        if len(value):
     82            value2 = re.sub("[-]", "", value)
     83            if not self.has_valid_checksum(value2):
     84                raise ValidationError(self.error_messages['checksum'])
    8485        return u'%s' % value
    8586
    8687    def has_valid_checksum(self, number):
Back to Top