Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #3866 -- Added Italian localflavors contribution from

flavio.curella@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4862 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit efd95dfedddb9b3a3e058b21ddd36398048e3ba4 1 parent 6f19ce8
Malcolm Tredinnick authored March 30, 2007
1  AUTHORS
@@ -67,6 +67,7 @@ answer newbie questions, and generally made Django that much better:
67 67
     Ian Clelland <clelland@gmail.com>
68 68
     crankycoder@gmail.com
69 69
     Matt Croydon <http://www.postneo.com/>
  70
+    flavio.curella@gmail.com
70 71
     Jure Cuhalev <gandalf@owca.info>
71 72
     dackze+django@gmail.com
72 73
     Dirk Datzert <dummy@habmalnefrage.de>
32  django/contrib/localflavor/it/forms.py
... ...
@@ -0,0 +1,32 @@
  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)
114  django/contrib/localflavor/it/it_province.py
... ...
@@ -0,0 +1,114 @@
  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', u'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
+)
24  django/contrib/localflavor/it/it_region.py
... ...
@@ -0,0 +1,24 @@
  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', u'Valle d’Aosta'),
  23
+    ('VEN', 'Veneto'),
  24
+)
0  localflavor/it/__init__.py b/django/contrib/localflavor/it/__init__.py
No changes.

0 notes on commit efd95df

Please sign in to comment.
Something went wrong with that request. Please try again.