Ticket #17275: 17275.diff
File 17275.diff, 2.8 KB (added by , 13 years ago) |
---|
-
django/contrib/localflavor/ca/forms.py
6 6 7 7 import re 8 8 9 from django.contrib.localflavor.ca.ca_provinces import PROVINCE_CHOICES, PROVINCES_NORMALIZED10 9 from django.core.validators import EMPTY_VALUES 11 10 from django.forms import ValidationError 12 11 from django.forms.fields import Field, CharField, Select … … 79 78 except AttributeError: 80 79 pass 81 80 else: 81 # Load data in memory only when it is required, see also #17275 82 from django.contrib.localflavor.ca.ca_provinces import PROVINCES_NORMALIZED 82 83 try: 83 84 return PROVINCES_NORMALIZED[value.strip().lower()].decode('ascii') 84 85 except KeyError: … … 91 92 territories as its choices. 92 93 """ 93 94 def __init__(self, attrs=None): 95 # Load data in memory only when it is required, see also #17275 96 from django.contrib.localflavor.ca.ca_provinces import PROVINCE_CHOICES 94 97 super(CAProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES) 95 98 96 99 class CASocialInsuranceNumberField(Field): -
django/contrib/localflavor/id/forms.py
8 8 import time 9 9 10 10 from django.core.validators import EMPTY_VALUES 11 from django.contrib.localflavor.id.id_choices import PROVINCE_CHOICES, LICENSE_PLATE_PREFIX_CHOICES12 11 from django.forms import ValidationError 13 12 from django.forms.fields import Field, Select 14 13 from django.utils.translation import ugettext_lazy as _ … … 58 57 """ 59 58 60 59 def __init__(self, attrs=None): 60 # Load data in memory only when it is required, see also #17275 61 from django.contrib.localflavor.id.id_choices import PROVINCE_CHOICES 61 62 super(IDProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES) 62 63 63 64 … … 93 94 """ 94 95 95 96 def __init__(self, attrs=None): 97 # Load data in memory only when it is required, see also #17275 98 from django.contrib.localflavor.id.id_choices import LICENSE_PLATE_PREFIX_CHOICES 96 99 super(IDLicensePlatePrefixSelect, self).__init__(attrs, 97 100 choices=LICENSE_PLATE_PREFIX_CHOICES) 98 101 … … 110 113 } 111 114 112 115 def clean(self, value): 116 # Load data in memory only when it is required, see also #17275 117 from django.contrib.localflavor.id.id_choices import LICENSE_PLATE_PREFIX_CHOICES 113 118 super(IDLicensePlateField, self).clean(value) 114 119 if value in EMPTY_VALUES: 115 120 return u''