Italy (it)

Forms

IT-specific Form helpers.

class localflavor.it.forms.ITPhoneNumberField(max_length=None, min_length=None, strip=True, empty_value='', *args, **kwargs)[source]

A form field that validates input as an Italian phone number.

Will strip any +39 country prefix from the number.

New in version 1.1.

class localflavor.it.forms.ITProvinceSelect(attrs=None)[source]

A Select widget that uses a list of IT provinces as its choices.

class localflavor.it.forms.ITRegionProvinceSelect(attrs=None)[source]

A Select widget that uses a named group list of IT regions mapped to regions as its choices.

class localflavor.it.forms.ITRegionSelect(attrs=None)[source]

A Select widget that uses a list of IT regions as its choices.

class localflavor.it.forms.ITSocialSecurityNumberField(max_length=None, min_length=None, *args, **kwargs)[source]

A form field that validates Italian Tax code (codice fiscale) for both persons and entities.

For reference see http://www.agenziaentrate.it/ and search for:

  • ‘Informazioni sulla codificazione delle persone fisiche’ for persons’ SSN
  • ‘Codice fiscale Modello AA5/6’ for entities’ SSN

Changed in version 1.1.

The ITSocialSecurityNumberField now also accepts SSN values for entities (numeric-only form).

class localflavor.it.forms.ITVatNumberField(required=True, widget=None, label=None, initial=None, help_text='', error_messages=None, show_hidden_initial=False, validators=(), localize=False, disabled=False, label_suffix=None)[source]

A form field that validates Italian VAT numbers (partita IVA).

class localflavor.it.forms.ITZipCodeField(max_length=None, min_length=None, *args, **kwargs)[source]

A form field that validates input as an Italian zip code.

Valid codes must have five digits.

Utilities

localflavor.it.util.ssn_check_digit(value)[source]

Calculate Italian social security number check digit.

localflavor.it.util.ssn_validation(ssn_value)[source]

Validate Italian SSN for persons

ValueError is raised if validation fails.

localflavor.it.util.vat_number_check_digit(vat_number)[source]

Calculate Italian VAT number check digit.

localflavor.it.util.vat_number_validation(vat_number)[source]

Validate Italian VAT number. Used also for entities SSN validation.

ValueError is raised if validation fails.

Data

localflavor.it.it_province.PROVINCE_CHOICES = (('AG', 'Agrigento'), ('AL', 'Alessandria'), ('AN', 'Ancona'), ('AO', 'Aosta'), ('AR', 'Arezzo'), ('AP', 'Ascoli Piceno'), ('AT', 'Asti'), ('AV', 'Avellino'), ('BA', 'Bari'), ('BT', 'Barletta-Andria-Trani'), ('BL', 'Belluno'), ('BN', 'Benevento'), ('BG', 'Bergamo'), ('BI', 'Biella'), ('BO', 'Bologna'), ('BZ', 'Bolzano/Bozen'), ('BS', 'Brescia'), ('BR', 'Brindisi'), ('CA', 'Cagliari'), ('CL', 'Caltanissetta'), ('CB', 'Campobasso'), ('CI', 'Carbonia-Iglesias'), ('CE', 'Caserta'), ('CT', 'Catania'), ('CZ', 'Catanzaro'), ('CH', 'Chieti'), ('CO', 'Como'), ('CS', 'Cosenza'), ('CR', 'Cremona'), ('KR', 'Crotone'), ('CN', 'Cuneo'), ('EN', 'Enna'), ('FM', 'Fermo'), ('FE', 'Ferrara'), ('FI', 'Firenze'), ('FG', 'Foggia'), ('FC', 'Forlì-Cesena'), ('FR', 'Frosinone'), ('GE', 'Genova'), ('GO', 'Gorizia'), ('GR', 'Grosseto'), ('IM', 'Imperia'), ('IS', 'Isernia'), ('SP', 'La Spezia'), ('AQ', 'L’Aquila'), ('LT', 'Latina'), ('LE', 'Lecce'), ('LC', 'Lecco'), ('LI', 'Livorno'), ('LO', 'Lodi'), ('LU', 'Lucca'), ('MC', 'Macerata'), ('MN', 'Mantova'), ('MS', 'Massa-Carrara'), ('MT', 'Matera'), ('VS', 'Medio Campidano'), ('ME', 'Messina'), ('MI', 'Milano'), ('MO', 'Modena'), ('MB', 'Monza e Brianza'), ('NA', 'Napoli'), ('NO', 'Novara'), ('NU', 'Nuoro'), ('OG', 'Ogliastra'), ('OT', 'Olbia-Tempio'), ('OR', 'Oristano'), ('PD', 'Padova'), ('PA', 'Palermo'), ('PR', 'Parma'), ('PV', 'Pavia'), ('PG', 'Perugia'), ('PU', 'Pesaro e Urbino'), ('PE', 'Pescara'), ('PC', 'Piacenza'), ('PI', 'Pisa'), ('PT', 'Pistoia'), ('PN', 'Pordenone'), ('PZ', 'Potenza'), ('PO', 'Prato'), ('RG', 'Ragusa'), ('RA', 'Ravenna'), ('RC', 'Reggio Calabria'), ('RE', 'Reggio Emilia'), ('RI', 'Rieti'), ('RN', 'Rimini'), ('RM', 'Roma'), ('RO', 'Rovigo'), ('SA', 'Salerno'), ('SS', 'Sassari'), ('SV', 'Savona'), ('SI', 'Siena'), ('SR', 'Siracusa'), ('SO', 'Sondrio'), ('TA', 'Taranto'), ('TE', 'Teramo'), ('TR', 'Terni'), ('TO', 'Torino'), ('TP', 'Trapani'), ('TN', 'Trento'), ('TV', 'Treviso'), ('TS', 'Trieste'), ('UD', 'Udine'), ('VA', 'Varese'), ('VE', 'Venezia'), ('VB', 'Verbano Cusio Ossola'), ('VC', 'Vercelli'), ('VR', 'Verona'), ('VV', 'Vibo Valentia'), ('VI', 'Vicenza'), ('VT', 'Viterbo'))

An alphabetical list of provinces

localflavor.it.it_province.PROVINCE_REGIONS = {'PR': 'EMR', 'PU': 'MAR', 'PE': 'ABR', 'TE': 'ABR', 'SP': 'LIG', 'NO': 'PMN', 'IM': 'LIG', 'RC': 'CAL', 'FC': 'EMR', 'RG': 'SIC', 'RE': 'EMR', 'TR': 'UMB', 'PA': 'SIC', 'CL': 'SIC', 'PC': 'EMR', 'FR': 'LAZ', 'BN': 'CAM', 'GO': 'FVG', 'PV': 'LOM', 'AG': 'SIC', 'CI': 'SAR', 'BZ': 'TAA', 'AV': 'CAM', 'MB': 'LOM', 'MO': 'EMR', 'VI': 'VEN', 'CN': 'PMN', 'TA': 'PUG', 'PO': 'TOS', 'LI': 'TOS', 'OT': 'SAR', 'SA': 'CAM', 'SV': 'LIG', 'ME': 'SIC', 'KR': 'CAL', 'PI': 'TOS', 'SO': 'LOM', 'BT': 'PUG', 'TO': 'PMN', 'AQ': 'ABR', 'RA': 'EMR', 'NA': 'CAM', 'TN': 'TAA', 'LE': 'PUG', 'VC': 'PMN', 'SI': 'TOS', 'AO': 'VAO', 'PD': 'VEN', 'OR': 'SAR', 'PG': 'UMB', 'IS': 'MOL', 'BO': 'EMR', 'PZ': 'BAS', 'LT': 'LAZ', 'VE': 'VEN', 'MN': 'LOM', 'VS': 'SAR', 'FI': 'TOS', 'MS': 'TOS', 'TV': 'VEN', 'RI': 'LAZ', 'MI': 'LOM', 'PT': 'TOS', 'SS': 'SAR', 'RO': 'VEN', 'VB': 'PMN', 'BR': 'PUG', 'FG': 'PUG', 'CR': 'LOM', 'LO': 'LOM', 'EN': 'SIC', 'MT': 'BAS', 'BA': 'PUG', 'OG': 'SAR', 'BS': 'LOM', 'CO': 'LOM', 'NU': 'SAR', 'SR': 'SIC', 'VR': 'VEN', 'AP': 'MAR', 'CZ': 'CAL', 'AN': 'MAR', 'VA': 'LOM', 'VV': 'CAL', 'RM': 'LAZ', 'MC': 'MAR', 'CB': 'MOL', 'LU': 'TOS', 'CE': 'CAM', 'CA': 'SAR', 'CH': 'ABR', 'BL': 'VEN', 'AL': 'PMN', 'TS': 'FVG', 'FM': 'MAR', 'VT': 'LAZ', 'TP': 'SIC', 'RN': 'EMR', 'GE': 'LIG', 'CS': 'CAL', 'FE': 'EMR', 'GR': 'TOS', 'BI': 'PMN', 'LC': 'LOM', 'CT': 'SIC', 'BG': 'LOM', 'AT': 'PMN', 'AR': 'TOS', 'PN': 'FVG', 'UD': 'FVG'}

A dictionary of provinces mapped to regions

New in version 1.1.

localflavor.it.it_region.REGION_CHOICES = (('ABR', 'Abruzzo'), ('BAS', 'Basilicata'), ('CAL', 'Calabria'), ('CAM', 'Campania'), ('EMR', 'Emilia-Romagna'), ('FVG', 'Friuli-Venezia Giulia'), ('LAZ', 'Lazio'), ('LIG', 'Liguria'), ('LOM', 'Lombardia'), ('MAR', 'Marche'), ('MOL', 'Molise'), ('PMN', 'Piemonte'), ('PUG', 'Puglia'), ('SAR', 'Sardegna'), ('SIC', 'Sicilia'), ('TOS', 'Toscana'), ('TAA', 'Trentino-Alto Adige'), ('UMB', 'Umbria'), ('VAO', 'Valle d’Aosta'), ('VEN', 'Veneto'))

An alphabetical list of regions

localflavor.it.it_region.REGION_PROVINCES = {'TOS': ['AR', 'FI', 'GR', 'LI', 'LU', 'MS', 'PI', 'PO', 'PT', 'SI'], 'LOM': ['BG', 'BS', 'CO', 'CR', 'LC', 'LO', 'MB', 'MI', 'MN', 'PV', 'SO', 'VA'], 'ABR': ['AQ', 'CH', 'PE', 'TE'], 'CAL': ['CS', 'CZ', 'KR', 'RC', 'VV'], 'LIG': ['GE', 'IM', 'SP', 'SV'], 'LAZ': ['FR', 'LT', 'RI', 'RM', 'VT'], 'EMR': ['BO', 'FC', 'FE', 'MO', 'PC', 'PR', 'RA', 'RE', 'RN'], 'MAR': ['AN', 'AP', 'FM', 'MC', 'PU'], 'PMN': ['AL', 'AT', 'BI', 'CN', 'NO', 'TO', 'VB', 'VC'], 'UMB': ['PG', 'TR'], 'SIC': ['AG', 'CL', 'CT', 'EN', 'ME', 'PA', 'RG', 'SR', 'TP'], 'TAA': ['BZ', 'TN'], 'VEN': ['BL', 'PD', 'RO', 'TV', 'VE', 'VI', 'VR'], 'MOL': ['CB', 'IS'], 'CAM': ['AV', 'BN', 'CE', 'NA', 'SA'], 'FVG': ['GO', 'PN', 'TS', 'UD'], 'BAS': ['MT', 'PZ'], 'PUG': ['BA', 'BR', 'BT', 'FG', 'LE', 'TA'], 'SAR': ['CA', 'CI', 'NU', 'OG', 'OR', 'OT', 'SS', 'VS'], 'VAO': ['AO']}

A dictionary of regions mapped to provinces

New in version 1.1.

localflavor.it.it_region.REGION_PROVINCE_CHOICES = [('Abruzzo', (('CH', 'Chieti'), ('AQ', 'L’Aquila'), ('PE', 'Pescara'), ('TE', 'Teramo'))), ('Basilicata', (('MT', 'Matera'), ('PZ', 'Potenza'))), ('Calabria', (('CZ', 'Catanzaro'), ('CS', 'Cosenza'), ('KR', 'Crotone'), ('RC', 'Reggio Calabria'), ('VV', 'Vibo Valentia'))), ('Campania', (('AV', 'Avellino'), ('BN', 'Benevento'), ('CE', 'Caserta'), ('NA', 'Napoli'), ('SA', 'Salerno'))), ('Emilia-Romagna', (('BO', 'Bologna'), ('FE', 'Ferrara'), ('FC', 'Forlì-Cesena'), ('MO', 'Modena'), ('PR', 'Parma'), ('PC', 'Piacenza'), ('RA', 'Ravenna'), ('RE', 'Reggio Emilia'), ('RN', 'Rimini'))), ('Friuli-Venezia Giulia', (('GO', 'Gorizia'), ('PN', 'Pordenone'), ('TS', 'Trieste'), ('UD', 'Udine'))), ('Lazio', (('FR', 'Frosinone'), ('LT', 'Latina'), ('RI', 'Rieti'), ('RM', 'Roma'), ('VT', 'Viterbo'))), ('Liguria', (('GE', 'Genova'), ('IM', 'Imperia'), ('SP', 'La Spezia'), ('SV', 'Savona'))), ('Lombardia', (('BG', 'Bergamo'), ('BS', 'Brescia'), ('CO', 'Como'), ('CR', 'Cremona'), ('LC', 'Lecco'), ('LO', 'Lodi'), ('MN', 'Mantova'), ('MI', 'Milano'), ('MB', 'Monza e Brianza'), ('PV', 'Pavia'), ('SO', 'Sondrio'), ('VA', 'Varese'))), ('Marche', (('AN', 'Ancona'), ('AP', 'Ascoli Piceno'), ('FM', 'Fermo'), ('MC', 'Macerata'), ('PU', 'Pesaro e Urbino'))), ('Molise', (('CB', 'Campobasso'), ('IS', 'Isernia'))), ('Piemonte', (('AL', 'Alessandria'), ('AT', 'Asti'), ('BI', 'Biella'), ('CN', 'Cuneo'), ('NO', 'Novara'), ('TO', 'Torino'), ('VB', 'Verbano Cusio Ossola'), ('VC', 'Vercelli'))), ('Puglia', (('BA', 'Bari'), ('BT', 'Barletta-Andria-Trani'), ('BR', 'Brindisi'), ('FG', 'Foggia'), ('LE', 'Lecce'), ('TA', 'Taranto'))), ('Sardegna', (('CA', 'Cagliari'), ('CI', 'Carbonia-Iglesias'), ('VS', 'Medio Campidano'), ('NU', 'Nuoro'), ('OG', 'Ogliastra'), ('OT', 'Olbia-Tempio'), ('OR', 'Oristano'), ('SS', 'Sassari'))), ('Sicilia', (('AG', 'Agrigento'), ('CL', 'Caltanissetta'), ('CT', 'Catania'), ('EN', 'Enna'), ('ME', 'Messina'), ('PA', 'Palermo'), ('RG', 'Ragusa'), ('SR', 'Siracusa'), ('TP', 'Trapani'))), ('Toscana', (('AR', 'Arezzo'), ('FI', 'Firenze'), ('GR', 'Grosseto'), ('LI', 'Livorno'), ('LU', 'Lucca'), ('MS', 'Massa-Carrara'), ('PI', 'Pisa'), ('PT', 'Pistoia'), ('PO', 'Prato'), ('SI', 'Siena'))), ('Trentino-Alto Adige', (('BZ', 'Bolzano/Bozen'), ('TN', 'Trento'))), ('Umbria', (('PG', 'Perugia'), ('TR', 'Terni'))), ('Valle d’Aosta', (('AO', 'Aosta'),)), ('Veneto', (('BL', 'Belluno'), ('PD', 'Padova'), ('RO', 'Rovigo'), ('TV', 'Treviso'), ('VE', 'Venezia'), ('VR', 'Verona'), ('VI', 'Vicenza')))]

A alphabetical list of provinces mapped to regions

New in version 1.1.