Ticket #17275: 17275.diff

File 17275.diff, 2.8 KB (added by Aymeric Augustin, 13 years ago)
  • django/contrib/localflavor/ca/forms.py

     
    66
    77import re
    88
    9 from django.contrib.localflavor.ca.ca_provinces import PROVINCE_CHOICES, PROVINCES_NORMALIZED
    109from django.core.validators import EMPTY_VALUES
    1110from django.forms import ValidationError
    1211from django.forms.fields import Field, CharField, Select
     
    7978        except AttributeError:
    8079            pass
    8180        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
    8283            try:
    8384                return PROVINCES_NORMALIZED[value.strip().lower()].decode('ascii')
    8485            except KeyError:
     
    9192    territories as its choices.
    9293    """
    9394    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
    9497        super(CAProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)
    9598
    9699class CASocialInsuranceNumberField(Field):
  • django/contrib/localflavor/id/forms.py

     
    88import time
    99
    1010from django.core.validators import EMPTY_VALUES
    11 from django.contrib.localflavor.id.id_choices import PROVINCE_CHOICES, LICENSE_PLATE_PREFIX_CHOICES
    1211from django.forms import ValidationError
    1312from django.forms.fields import Field, Select
    1413from django.utils.translation import ugettext_lazy as _
     
    5857    """
    5958
    6059    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
    6162        super(IDProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)
    6263
    6364
     
    9394    """
    9495
    9596    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
    9699        super(IDLicensePlatePrefixSelect, self).__init__(attrs,
    97100            choices=LICENSE_PLATE_PREFIX_CHOICES)
    98101
     
    110113    }
    111114
    112115    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
    113118        super(IDLicensePlateField, self).clean(value)
    114119        if value in EMPTY_VALUES:
    115120            return u''
Back to Top