Django

Code

Show
Ignore:
Timestamp:
12/17/07 02:05:27 (10 months ago)
Author:
mtredinnick
Message:

Fixed #5871 -- Factored out the validation errors in localflavor form fields. Brings them into line with the standard newforms fields. Patch from Jan Rademaker.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/localflavor/in_/forms.py

    r5876 r6926  
    1111 
    1212class INZipCodeField(RegexField): 
     13    default_error_messages = { 
     14        'invalid': gettext(u'Enter a zip code in the format XXXXXXX.'), 
     15    } 
     16 
    1317    def __init__(self, *args, **kwargs): 
    1418        super(INZipCodeField, self).__init__(r'^\d{6}$', 
    15             max_length=None, min_length=None, 
    16             error_message=gettext(u'Enter a zip code in the format XXXXXXX.'), 
    17             *args, **kwargs) 
     19            max_length=None, min_length=None, *args, **kwargs) 
    1820 
    1921class INStateField(Field): 
     
    2325    registration abbreviation for the given state or union territory 
    2426    """ 
     27    default_error_messages = { 
     28        'invalid': u'Enter a Indian state or territory.', 
     29    } 
     30 
    2531    def clean(self, value): 
    2632        from in_states import STATES_NORMALIZED 
     
    3743            except KeyError: 
    3844                pass 
    39         raise ValidationError(u'Enter a Indian state or territory.'
     45        raise ValidationError(self.error_messages['invalid']
    4046 
    4147class INStateSelect(Select):