Ticket #16338: localflavor_at_postal.diff

File localflavor_at_postal.diff, 1.8 KB (added by Bernhard Essl, 13 years ago)
  • docs/ref/contrib/localflavor.txt

     
    243243
    244244.. class:: at.forms.ATZipCodeField
    245245
    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).
    247247
    248248.. class:: at.forms.ATStateSelect
    249249
  • django/contrib/localflavor/at/forms.py

     
    1616    """
    1717    A form field that validates its input is an Austrian postcode.
    1818
    19     Accepts 4 digits.
     19    Accepts 4 digits (first digit must be greater than 0).
    2020    """
    2121    default_error_messages = {
    2222        'invalid': _('Enter a zip code in the format XXXX.'),
    2323    }
    2424    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}$',
    2626                max_length, min_length, *args, **kwargs)
    2727
    2828class ATStateSelect(Select):
  • tests/regressiontests/forms/localflavor/at.py

     
    2828            '8020': '8020',
    2929        }
    3030        invalid = {
     31            '0000'  : error_format,
     32            '0123'  : error_format,
    3133            '111222': error_format,
    3234            'eeffee': error_format,
    3335        }
Back to Top