Ticket #3866: it_localflavor.diff
File it_localflavor.diff, 5.3 KB (added by , 18 years ago) |
---|
-
django/contrib/localflavor/it/it_region.py
1 # -*- coding: utf-8 -* 2 3 REGION_CHOICES = ( 4 ('ABR', 'Abruzzo'), 5 ('BAS', 'Basilicata'), 6 ('CAL', 'Calabria'), 7 ('CAM', 'Campania'), 8 ('EMR', 'Emilia-Romagna'), 9 ('FVG', 'Friuli-Venezia Giulia'), 10 ('LAZ', 'Lazio'), 11 ('LIG', 'Liguria'), 12 ('LOM', 'Lombardia'), 13 ('MAR', 'Marche'), 14 ('MOL', 'Molise'), 15 ('PMN', 'Piemonte'), 16 ('PUG', 'Puglia'), 17 ('SAR', 'Sardegna'), 18 ('SIC', 'Sicilia'), 19 ('TOS', 'Toscana'), 20 ('TAA', 'Trentino-Alto Adige'), 21 ('UMB', 'Umbria'), 22 ('VAO', 'Valle d’Aosta'), 23 ('VEN', 'Veneto'), 24 ) -
django/contrib/localflavor/it/it_province.py
1 # -*- coding: utf-8 -* 2 3 PROVINCE_CHOICES = ( 4 ('AG', 'Agrigento'), 5 ('AL', 'Alessandria'), 6 ('AN', 'Ancona'), 7 ('AO', 'Aosta'), 8 ('AR', 'Arezzo'), 9 ('AP', 'Ascoli Piceno'), 10 ('AT', 'Asti'), 11 ('AV', 'Avellino'), 12 ('BA', 'Bari'), 13 # ('BT', 'Barletta-Andria-Trani'), # active starting from 2009 14 ('BL', 'Belluno'), 15 ('BN', 'Benevento'), 16 ('BG', 'Bergamo'), 17 ('BI', 'Biella'), 18 ('BO', 'Bologna'), 19 ('BZ', 'Bolzano/Bozen'), 20 ('BS', 'Brescia'), 21 ('BR', 'Brindisi'), 22 ('CA', 'Cagliari'), 23 ('CL', 'Caltanissetta'), 24 ('CB', 'Campobasso'), 25 ('CI', 'Carbonia-Iglesias'), 26 ('CE', 'Caserta'), 27 ('CT', 'Catania'), 28 ('CZ', 'Catanzaro'), 29 ('CH', 'Chieti'), 30 ('CO', 'Como'), 31 ('CS', 'Cosenza'), 32 ('CR', 'Cremona'), 33 ('KR', 'Crotone'), 34 ('CN', 'Cuneo'), 35 ('EN', 'Enna'), 36 # ('FM', 'Fermo'), # active starting from 2009 37 ('FE', 'Ferrara'), 38 ('FI', 'Firenze'), 39 ('FG', 'Foggia'), 40 ('FC', 'Forlì-Cesena'), 41 ('FR', 'Frosinone'), 42 ('GE', 'Genova'), 43 ('GO', 'Gorizia'), 44 ('GR', 'Grosseto'), 45 ('IM', 'Imperia'), 46 ('IS', 'Isernia'), 47 ('SP', 'La Spezia'), 48 ('AQ', 'L’Acquila'), 49 ('LT', 'Latina'), 50 ('LE', 'Lecce'), 51 ('LC', 'Lecco'), 52 ('LI', 'Livorno'), 53 ('LO', 'Lodi'), 54 ('LU', 'Lucca'), 55 ('MC', 'Macerata'), 56 ('MN', 'Mantova'), 57 ('MS', 'Massa-Carrara'), 58 ('MT', 'Matera'), 59 ('VS', 'Medio Campidano'), 60 ('ME', 'Messina'), 61 ('MI', 'Milano'), 62 ('MO', 'Modena'), 63 # ('MB', 'Monza e Brianza'), # active starting from 2009 64 ('NA', 'Napoli'), 65 ('NO', 'Novara'), 66 ('NU', 'Nuoro'), 67 ('OG', 'Ogliastra'), 68 ('OT', 'Olbia-Tempio'), 69 ('OR', 'Oristano'), 70 ('PD', 'Padova'), 71 ('PA', 'Palermo'), 72 ('PR', 'Parma'), 73 ('PV', 'Pavia'), 74 ('PG', 'Perugia'), 75 ('PU', 'Pesaro e Urbino'), 76 ('PE', 'Pescara'), 77 ('PC', 'Piacenza'), 78 ('PI', 'Pisa'), 79 ('PT', 'Pistoia'), 80 ('PN', 'Pordenone'), 81 ('PZ', 'Potenza'), 82 ('PO', 'Prato'), 83 ('RG', 'Ragusa'), 84 ('RA', 'Ravenna'), 85 ('RC', 'Reggio Calabria'), 86 ('RE', 'Reggio Emilia'), 87 ('RI', 'Rieti'), 88 ('RN', 'Rimini') 89 ('RM', 'Roma'), 90 ('RO', 'Rovigo'), 91 ('SA', 'Salerno'), 92 ('SS', 'Sassari'), 93 ('SV', 'Savona'), 94 ('SI', 'Siena'), 95 ('SR', 'Siracusa'), 96 ('SO', 'Sondrio'), 97 ('TA', 'Taranto'), 98 ('TE', 'Teramo'), 99 ('TR', 'Terni'), 100 ('TO', 'Torino'), 101 ('TP', 'Trapani'), 102 ('TN', 'Trento'), 103 ('TV', 'Treviso'), 104 ('TS', 'Trieste'), 105 ('UD', 'Udine'), 106 ('VA', 'Varese'), 107 ('VE', 'Venezia'), 108 ('VB', 'Verbano Cusio Ossola'), 109 ('VC', 'Vercelli'), 110 ('VR', 'Verona'), 111 ('VV', 'Vibo Valentia'), 112 ('VI', 'Vicenza'), 113 ('VT', 'Viterbo'), 114 ) -
django/contrib/localflavor/it/forms.py
1 """ 2 IT-specific Form helpers 3 """ 4 5 from django.newforms import ValidationError 6 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 7 from django.newforms.util import smart_unicode 8 from django.utils.translation import gettext 9 import re 10 11 class ITZipCodeField(RegexField): 12 def __init__(self, *args, **kwargs): 13 super(ITZipCodeField, self).__init__(r'^\d{5}$', 14 max_length=None, min_length=None, 15 error_message=gettext(u'Enter a zip code in the format XXXXX.'), 16 *args, **kwargs) 17 18 class ITRegionSelect(Select): 19 """ 20 A Select widget that uses a list of IT regions as its choices. 21 """ 22 def __init__(self, attrs=None): 23 from it_region import REGION_CHOICES # relative import 24 super(ITRegionSelect, self).__init__(attrs, choices=REGION_CHOICES) 25 26 class ITProvinceSelect(Select): 27 """ 28 A Select widget that uses a list of IT regions as its choices. 29 """ 30 def __init__(self, attrs=None): 31 from it_province import PROVINCE_CHOICES # relative import 32 super(ITProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)