Ticket #4092: 4092_6194_simple.diff
File 4092_6194_simple.diff, 20.3 KB (added by , 17 years ago) |
---|
-
django/contrib/localflavor/us/forms.py
6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.utils.encoding import smart_unicode 8 8 from django.utils.translation import ugettext 9 from itertools import chain 9 10 import re 10 11 11 12 phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$') … … 94 95 """ 95 96 A Select widget that uses a list of U.S. states/territories as its choices. 96 97 """ 97 def __init__(self, attrs=None ):98 def __init__(self, attrs=None, empty_label=u"---------"): 98 99 from us_states import STATE_CHOICES 99 super(USStateSelect, self).__init__(attrs, choices=STATE_CHOICES) 100 select_choices = STATE_CHOICES 101 if empty_label is not None: 102 select_choices = chain(((u'', empty_label),), STATE_CHOICES) 103 super(USStateSelect, self).__init__(attrs, choices=select_choices) -
django/contrib/localflavor/de/forms.py
5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.utils.translation import ugettext 8 from itertools import chain 8 9 import re 9 10 10 11 id_re = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})[-\ ]?(?P<birthday>\d{7})[-\ ]?(?P<validity>\d{7})[-\ ]?(?P<checksum>\d{1})$") … … 20 21 """ 21 22 A Select widget that uses a list of DE states as its choices. 22 23 """ 23 def __init__(self, attrs=None ):24 def __init__(self, attrs=None, empty_label=u"---------"): 24 25 from de_states import STATE_CHOICES 25 super(DEStateSelect, self).__init__(attrs, choices=STATE_CHOICES) 26 select_choices = STATE_CHOICES 27 if empty_label is not None: 28 select_choices = chain(((u'', empty_label),), STATE_CHOICES) 29 super(DEStateSelect, self).__init__(attrs, choices=select_choices) 26 30 27 31 class DEIdentityCardNumberField(Field): 28 32 """ -
django/contrib/localflavor/ch/forms.py
6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.utils.encoding import smart_unicode 8 8 from django.utils.translation import ugettext 9 from itertools import chain 9 10 import re 10 11 11 12 id_re = re.compile(r"^(?P<idnumber>\w{8})(?P<pos9>(\d{1}|<))(?P<checksum>\d{1})$") … … 39 40 """ 40 41 A Select widget that uses a list of CH states as its choices. 41 42 """ 42 def __init__(self, attrs=None ):43 def __init__(self, attrs=None, empty_label=u"---------"): 43 44 from ch_states import STATE_CHOICES # relative import 44 super(CHStateSelect, self).__init__(attrs, choices=STATE_CHOICES) 45 select_choices = STATE_CHOICES 46 if empty_label is not None: 47 select_choices = chain(((u'', empty_label),), STATE_CHOICES) 48 super(CHStateSelect, self).__init__(attrs, choices=select_choices) 45 49 46 50 class CHIdentityCardNumberField(Field): 47 51 """ -
django/contrib/localflavor/fi/forms.py
6 6 from django.newforms import ValidationError 7 7 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 8 8 from django.utils.translation import ugettext 9 from itertools import chain 9 10 10 11 class FIZipCodeField(RegexField): 11 12 def __init__(self, *args, **kwargs): … … 18 19 """ 19 20 A Select widget that uses a list of Finnish municipalities as its choices. 20 21 """ 21 def __init__(self, attrs=None ):22 def __init__(self, attrs=None, empty_label=u"---------"): 22 23 from fi_municipalities import MUNICIPALITY_CHOICES 23 super(FIMunicipalitySelect, self).__init__(attrs, choices=MUNICIPALITY_CHOICES) 24 select_choices = MUNICIPALITY_CHOICES 25 if empty_label is not None: 26 select_choices = chain(((u'', empty_label),), MUNICIPALITY_CHOICES) 27 super(FIMunicipalitySelect, self).__init__(attrs, choices=select_choices) 24 28 25 29 class FISocialSecurityNumber(Field): 26 30 def clean(self, value): -
django/contrib/localflavor/cl/forms.py
6 6 from django.newforms.fields import RegexField, Select, EMPTY_VALUES 7 7 from django.utils.translation import ugettext 8 8 from django.utils.encoding import smart_unicode 9 from itertools import chain 9 10 10 11 11 12 class CLRegionSelect(Select): … … 13 14 A Select widget that uses a list of Chilean Regions (Regiones) 14 15 as its choices. 15 16 """ 16 def __init__(self, attrs=None ):17 def __init__(self, attrs=None, empty_label=u"---------"): 17 18 from cl_regions import REGION_CHOICES 18 super(CLRegionSelect, self).__init__(attrs, choices=REGION_CHOICES) 19 select_choices = REGION_CHOICES 20 if empty_label is not None: 21 select_choices = chain(((u'', empty_label),), REGION_CHOICES) 22 super(CLRegionSelect, self).__init__(attrs, choices=select_choices) 19 23 20 24 class CLRutField(RegexField): 21 25 """ -
django/contrib/localflavor/ar/forms.py
7 7 from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES 8 8 from django.utils.encoding import smart_unicode 9 9 from django.utils.translation import ugettext 10 from itertools import chain 10 11 import re 11 12 12 13 class ARProvinceSelect(Select): … … 14 15 A Select widget that uses a list of Argentinean provinces/autonomous cities 15 16 as its choices. 16 17 """ 17 def __init__(self, attrs=None ):18 def __init__(self, attrs=None, empty_label=u"---------"): 18 19 from ar_provinces import PROVINCE_CHOICES 19 super(ARProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES) 20 select_choices = PROVINCE_CHOICES 21 if empty_label is not None: 22 select_choices = chain(((u'', empty_label),), PROVINCE_CHOICES) 23 super(ARProvinceSelect, self).__init__(attrs, choices=select_choices) 20 24 21 25 class ARPostalCodeField(RegexField): 22 26 """ -
django/contrib/localflavor/br/forms.py
7 7 from django.newforms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES 8 8 from django.utils.encoding import smart_unicode 9 9 from django.utils.translation import ugettext as _ 10 from itertools import chain 10 11 import re 11 12 12 13 try: … … 39 40 A Select widget that uses a list of Brazilian states/territories 40 41 as its choices. 41 42 """ 42 def __init__(self, attrs=None ):43 def __init__(self, attrs=None, empty_label=u"---------"): 43 44 from br_states import STATE_CHOICES 44 super(BRStateSelect, self).__init__(attrs, choices=STATE_CHOICES) 45 select_choices = STATE_CHOICES 46 if empty_label is not None: 47 select_choices = chain(((u'', empty_label),), STATE_CHOICES) 48 super(BRStateSelect, self).__init__(attrs, choices=select_choices) 45 49 46 50 class BRStateChoiceField(Field): 47 51 """ -
django/contrib/localflavor/in_/forms.py
6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.utils.encoding import smart_unicode 8 8 from django.utils.translation import gettext 9 from itertools import chain 9 10 import re 10 11 11 12 … … 43 44 A Select widget that uses a list of Indian states/territories as its 44 45 choices. 45 46 """ 46 def __init__(self, attrs=None ):47 def __init__(self, attrs=None, empty_label=u"---------"): 47 48 from in_states import STATE_CHOICES 48 super(INStateSelect, self).__init__(attrs, choices=STATE_CHOICES) 49 select_choices = STATE_CHOICES 50 if empty_label is not None: 51 select_choices = chain(((u'', empty_label),), STATE_CHOICES) 52 super(INStateSelect, self).__init__(attrs, choices=select_choices) 49 53 -
django/contrib/localflavor/au/forms.py
6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.newforms.util import smart_unicode 8 8 from django.utils.translation import ugettext 9 from itertools import chain 9 10 import re 10 11 11 12 PHONE_DIGITS_RE = re.compile(r'^(\d{10})$') … … 38 39 A Select widget that uses a list of Australian states/territories as its 39 40 choices. 40 41 """ 41 def __init__(self, attrs=None ):42 def __init__(self, attrs=None, empty_label=u"---------"): 42 43 from au_states import STATE_CHOICES 43 super(AUStateSelect, self).__init__(attrs, choices=STATE_CHOICES) 44 select_choices = STATE_CHOICES 45 if empty_label is not None: 46 select_choices = chain(((u'', empty_label),), STATE_CHOICES) 47 super(AUStateSelect, self).__init__(attrs, choices=select_choices) -
django/contrib/localflavor/fr/forms.py
6 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 7 from django.utils.encoding import smart_unicode 8 8 from django.utils.translation import ugettext 9 from itertools import chain 9 10 import re 10 11 11 12 phone_digits_re = re.compile(r'^0\d(\s|\.)?(\d{2}(\s|\.)?){3}\d{2}$') … … 38 39 """ 39 40 A Select widget that uses a list of FR departments as its choices. 40 41 """ 41 def __init__(self, attrs=None ):42 def __init__(self, attrs=None, empty_label=u"---------"): 42 43 from fr_department import DEPARTMENT_ASCII_CHOICES 43 super(FRDepartmentSelect, self).__init__(attrs, choices=DEPARTMENT_ASCII_CHOICES) 44 select_choices = DEPARTMENT_ASCII_CHOICES 45 if empty_label is not None: 46 select_choices = chain(((u'', empty_label),), DEPARTMENT_ASCII_CHOICES) 47 super(FRDepartmentSelect, self).__init__(attrs, choices=select_choices) 44 48 -
django/contrib/localflavor/nl/forms.py
8 8 from django.newforms.fields import Field, Select, EMPTY_VALUES 9 9 from django.utils.translation import ugettext as _ 10 10 from django.utils.encoding import smart_unicode 11 from itertools import chain 11 12 12 13 pc_re = re.compile('^\d{4}[A-Z]{2}$') 13 14 sofi_re = re.compile('^\d{9}$') … … 37 38 A Select widget that uses a list of provinces of the Netherlands as its 38 39 choices. 39 40 """ 40 def __init__(self, attrs=None ):41 def __init__(self, attrs=None, empty_label=u"---------"): 41 42 from nl_provinces import PROVINCE_CHOICES 42 super(NLProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES) 43 select_choices = PROVINCE_CHOICES 44 if empty_label is not None: 45 select_choices = chain(((u'', empty_label),), PROVINCE_CHOICES) 46 super(NLProvinceSelect, self).__init__(attrs, choices=select_choices) 43 47 44 48 class NLPhoneNumberField(Field): 45 49 """ -
django/contrib/localflavor/jp/forms.py
6 6 from django.newforms import ValidationError 7 7 from django.utils.translation import ugettext 8 8 from django.newforms.fields import RegexField, Select 9 from itertools import chain 9 10 10 11 import re 11 12 … … 33 34 """ 34 35 A Select widget that uses a list of Japanese prefectures as its choices. 35 36 """ 36 def __init__(self, attrs=None ):37 def __init__(self, attrs=None, empty_label=u"---------"): 37 38 from jp_prefectures import JP_PREFECTURES 38 super(JPPrefectureSelect, self).__init__(attrs, choices=JP_PREFECTURES) 39 select_choices = JP_PREFECTURES 40 if empty_label is not None: 41 select_choices = chain(((u'', empty_label),), JP_PREFECTURES) 42 super(JPPrefectureSelect, self).__init__(attrs, choices=select_choices) -
django/contrib/localflavor/is_/forms.py
7 7 from django.newforms.widgets import Select 8 8 from django.utils.translation import ugettext 9 9 from django.utils.encoding import smart_unicode 10 from itertools import chain 10 11 11 12 class ISIdNumberField(RegexField): 12 13 """ … … 72 73 """ 73 74 A Select widget that uses a list of Icelandic postal codes as its choices. 74 75 """ 75 def __init__(self, attrs=None ):76 def __init__(self, attrs=None, empty_label=u"---------"): 76 77 from is_postalcodes import IS_POSTALCODES 77 super(ISPostalCodeSelect, self).__init__(attrs, choices=IS_POSTALCODES) 78 select_choices = IS_POSTALCODES 79 if empty_label is not None: 80 select_choices = chain(((u'', empty_label),), IS_POSTALCODES) 81 super(ISPostalCodeSelect, self).__init__(attrs, choices=select_choices) 78 82 -
django/contrib/localflavor/pl/forms.py
5 5 from django.newforms import ValidationError 6 6 from django.newforms.fields import Select, RegexField 7 7 from django.utils.translation import ugettext as _ 8 from itertools import chain 8 9 9 10 class PLVoivodeshipSelect(Select): 10 11 """ 11 12 A select widget with list of Polish voivodeships (administrative provinces) 12 13 as choices. 13 14 """ 14 def __init__(self, attrs=None ):15 def __init__(self, attrs=None, empty_label=u"---------"): 15 16 from pl_voivodeships import VOIVODESHIP_CHOICES 16 super(PLVoivodeshipSelect, self).__init__(attrs, choices=VOIVODESHIP_CHOICES) 17 select_choices = VOIVODESHIP_CHOICES 18 if empty_label is not None: 19 select_choices = chain(((u'', empty_label),), VOIVODESHIP_CHOICES) 20 super(PLVoivodeshipSelect, self).__init__(attrs, choices=select_choices) 17 21 18 22 class PLAdministrativeUnitSelect(Select): 19 23 """ 20 24 A select widget with list of Polish administrative units as choices. 21 25 """ 22 def __init__(self, attrs=None ):26 def __init__(self, attrs=None, empty_label=u"---------"): 23 27 from pl_administrativeunits import ADMINISTRATIVE_UNIT_CHOICES 24 super(PLAdministrativeUnitSelect, self).__init__(attrs, choices=ADMINISTRATIVE_UNIT_CHOICES) 28 select_choices = ADMINISTRATIVE_UNIT_CHOICES 29 if empty_label is not None: 30 select_choices = chain(((u'', empty_label),), ADMINISTRATIVE_UNIT_CHOICES) 31 super(PLAdministrativeUnitSelect, self).__init__(attrs, choices=select_choices) 25 32 26 33 class PLNationalIdentificationNumberField(RegexField): 27 34 """ -
django/contrib/localflavor/no/forms.py
6 6 from django.newforms import ValidationError 7 7 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 8 8 from django.utils.translation import ugettext 9 from itertools import chain 9 10 10 11 class NOZipCodeField(RegexField): 11 12 def __init__(self, *args, **kwargs): … … 19 20 A Select widget that uses a list of Norwegian municipalities (fylker) 20 21 as its choices. 21 22 """ 22 def __init__(self, attrs=None ):23 def __init__(self, attrs=None, empty_label=u"---------"): 23 24 from no_municipalities import MUNICIPALITY_CHOICES 24 super(NOMunicipalitySelect, self).__init__(attrs, choices=MUNICIPALITY_CHOICES) 25 select_choices = MUNICIPALITY_CHOICES 26 if empty_label is not None: 27 select_choices = chain(((u'', empty_label),), MUNICIPALITY_CHOICES) 28 super(NOMunicipalitySelect, self).__init__(attrs, choices=select_choices) 25 29 26 30 class NOSocialSecurityNumber(Field): 27 31 """ -
django/contrib/localflavor/it/forms.py
7 7 from django.utils.translation import ugettext 8 8 from django.utils.encoding import smart_unicode 9 9 from django.contrib.localflavor.it.util import ssn_check_digit, vat_number_check_digit 10 from itertools import chain 10 11 import re 11 12 12 13 class ITZipCodeField(RegexField): … … 20 21 """ 21 22 A Select widget that uses a list of IT regions as its choices. 22 23 """ 23 def __init__(self, attrs=None ):24 def __init__(self, attrs=None, empty_label=u"---------"): 24 25 from it_region import REGION_CHOICES 25 super(ITRegionSelect, self).__init__(attrs, choices=REGION_CHOICES) 26 select_choices = REGION_CHOICES 27 if empty_label is not None: 28 select_choices = chain(((u'', empty_label),), REGION_CHOICES) 29 super(ITRegionSelect, self).__init__(attrs, choices=select_choices) 26 30 27 31 class ITProvinceSelect(Select): 28 32 """ 29 33 A Select widget that uses a list of IT regions as its choices. 30 34 """ 31 def __init__(self, attrs=None ):35 def __init__(self, attrs=None, empty_label=u"---------"): 32 36 from it_province import PROVINCE_CHOICES 33 super(ITProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES) 37 select_choices = PROVINCE_CHOICES 38 if empty_label is not None: 39 select_choices = chain(((u'', empty_label),), PROVINCE_CHOICES) 40 super(ITProvinceSelect, self).__init__(attrs, choices=select_choices) 34 41 35 42 class ITSocialSecurityNumberField(RegexField): 36 43 """ -
django/contrib/localflavor/sk/forms.py
4 4 5 5 from django.newforms.fields import Select, RegexField 6 6 from django.utils.translation import ugettext 7 from itertools import chain 7 8 8 9 class SKRegionSelect(Select): 9 10 """ 10 11 A select widget widget with list of Slovak regions as choices. 11 12 """ 12 def __init__(self, attrs=None ):13 def __init__(self, attrs=None, empty_label=u"---------"): 13 14 from sk_regions import REGION_CHOICES 14 super(SKRegionSelect, self).__init__(attrs, choices=REGION_CHOICES) 15 select_choices = REGION_CHOICES 16 if empty_label is not None: 17 select_choices = chain(((u'', empty_label),), REGION_CHOICES) 18 super(SKRegionSelect, self).__init__(attrs, choices=select_choices) 15 19 16 20 class SKDistrictSelect(Select): 17 21 """ 18 22 A select widget with list of Slovak districts as choices. 19 23 """ 20 def __init__(self, attrs=None ):24 def __init__(self, attrs=None, empty_label=u"---------"): 21 25 from sk_districts import DISTRICT_CHOICES 22 super(SKDistrictSelect, self).__init__(attrs, choices=DISTRICT_CHOICES) 26 select_choices = DISTRICT_CHOICES 27 if empty_label is not None: 28 select_choices = chain(((u'', empty_label),), DISTRICT_CHOICES) 29 super(SKDistrictSelect, self).__init__(attrs, choices=select_choices) 23 30 24 31 class SKPostalCodeField(RegexField): 25 32 """