Django

Code

Show
Ignore:
Timestamp:
12/17/07 02:05:27 (1 year 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/is_/forms.py

    r5876 r6926  
    1414    of Iceland has. 
    1515    """ 
     16    default_error_messages = { 
     17        'invalid': ugettext('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'), 
     18        'checksum': ugettext(u'The Icelandic identification number is not valid.'), 
     19    } 
     20 
    1621    def __init__(self, *args, **kwargs): 
    17         error_msg = ugettext('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.') 
    1822        kwargs['min_length'],kwargs['max_length'] = 10,11 
    19         super(ISIdNumberField, self).__init__(r'^\d{6}(-| )?\d{4}$', error_message=error_msg, *args, **kwargs) 
     23        super(ISIdNumberField, self).__init__(r'^\d{6}(-| )?\d{4}$', *args, **kwargs) 
    2024 
    2125    def clean(self, value): 
     
    2933            return self._format(value) 
    3034        else: 
    31             raise ValidationError(ugettext(u'The Icelandic identification number is not valid.')
     35            raise ValidationError(self.error_messages['checksum']
    3236 
    3337    def _canonify(self, value):