Esempio n. 1
0
def au_postcode_validator(sender, postcode=None, country=None, **kwargs):
    if country.iso2_code == 'AU':
        from satchmo.l10n.validators import aupostcode
        try:
            pc = aupostcode.validate(postcode)
            return pc
        except ValueError, ve:
            raise forms.ValidationError('Please enter a valid Australian postal code.')
Esempio n. 2
0
def au_postcode_validator(sender, postcode=None, country=None, **kwargs):
    if country.iso2_code == 'AU':
        from satchmo.l10n.validators import aupostcode
        try:
            pc = aupostcode.validate(postcode)
            return pc
        except ValueError, ve:
            raise forms.ValidationError('Please enter a valid Australian postal code.')
Esempio n. 3
0
 def test_valid(self):
     code = aupostcode.validate("2000")
     self.assertEqual('2000', code)
     code = aupostcode.validate(" 2000 ")
     self.assertEqual('2000', code)
Esempio n. 4
0
 def test_valid(self):
     code = aupostcode.validate("2000")
     self.assertEqual('2000', code)
     code = aupostcode.validate(" 2000 ")
     self.assertEqual('2000', code)