Ticket #16338: localflavor_at_postal.diff
File localflavor_at_postal.diff, 1.8 KB (added by , 13 years ago) |
---|
-
docs/ref/contrib/localflavor.txt
243 243 244 244 .. class:: at.forms.ATZipCodeField 245 245 246 A form field that validates its input as an Austrian zip code .246 A form field that validates its input as an Austrian zip code, with the format XXXX (first digit must be greater than 0). 247 247 248 248 .. class:: at.forms.ATStateSelect 249 249 -
django/contrib/localflavor/at/forms.py
16 16 """ 17 17 A form field that validates its input is an Austrian postcode. 18 18 19 Accepts 4 digits .19 Accepts 4 digits (first digit must be greater than 0). 20 20 """ 21 21 default_error_messages = { 22 22 'invalid': _('Enter a zip code in the format XXXX.'), 23 23 } 24 24 def __init__(self, max_length=None, min_length=None, *args, **kwargs): 25 super(ATZipCodeField, self).__init__(r'^ \d{4}$',25 super(ATZipCodeField, self).__init__(r'^[1-9]{1}\d{3}$', 26 26 max_length, min_length, *args, **kwargs) 27 27 28 28 class ATStateSelect(Select): -
tests/regressiontests/forms/localflavor/at.py
28 28 '8020': '8020', 29 29 } 30 30 invalid = { 31 '0000' : error_format, 32 '0123' : error_format, 31 33 '111222': error_format, 32 34 'eeffee': error_format, 33 35 }