The “local flavor” app

django-localflavor is a collection of assorted pieces of code that are useful for particular countries or cultures. These are called the “local flavor” add-ons and live in the localflavor package.

Inside that package, country- or culture-specific code is organized into subpackages, named using ISO 3166 country codes.

Most of the localflavor add-ons are localized form components deriving from the forms framework – for example, a USStateField that knows how to validate U.S. state abbreviations, and a FISocialSecurityNumber that knows how to validate Finnish social security numbers.

To use one of these localized components, just import the relevant subpackage. For example, here’s how you can create a form with a field representing a Greek postal code:

from django import forms
from localflavor.gr.forms import GRPostalCodeField

class MyForm(forms.Form):
    my_greek_postal_code = GRPostalCodeField()

The localflavor package also includes a generic subpackage, containing useful code that is not specific to one particular country or culture. This package defines date, datetime and split datetime input fields based on those from the forms, but with non-US default formats. Here’s an example of how to use them:

from django import forms
from localflavor import generic

class MyForm(forms.Form):
    my_date_field = generic.forms.DateField()

The localflavor generic package also has IBAN and BIC model and form fields. Here’s an example of how to use the IBAN and BIC form fields:

from django import forms
from localflavor.generic.forms import BICFormField, IBANFormField

class MyForm(forms.Form):
    iban = IBANFormField()
    bic = BICFormField()

Installation

To install django-localflavor use your favorite packaging tool, e.g.pip:

pip install django-localflavor

Or download the source distribution from PyPI at https://pypi.python.org/pypi/django-localflavor, decompress the file and run python setup.py install in the unpacked directory.

Then add 'localflavor' to your INSTALLED_APPS setting:

INSTALLED_APPS = (
    # ...
    'localflavor',
)

Note

Adding 'localflavor' to your INSTALLED_APPS setting is required for migrations and translations to work. Using django-localflavor without adding it to your INSTALLED_APPS setting is not recommended.

Internationalization

Local flavor has its own catalog of translations, in the directory localflavor/locale, and it’s not loaded automatically like Django’s general catalog in django/conf/locale. If you want local flavor’s texts to be translated, like form fields error messages, you must include localflavor in the INSTALLED_APPS setting, so the internationalization system can find the catalog, as explained in How Django discovers translations.

Adding flavors

We’d love to add more of these, so please create an issue or pull request with any code you’d like to contribute. See any of the existing flavors for examples.

See the contributing documentation for how to run the tests while working on a local flavor.

If you consider adding a new localflavor for country here are some examples that you might consider implementing:

  • form fields and form widgets
    • ID verification
    • tax or social security number validator
    • car registration
    • postal code validation
    • country area selects, e.g. cities, counties, states, provinces
  • model fields, e.g. for storing any of the above form fields’ values
  • local translations of English area names. Join your language team at Transifex: https://www.transifex.com/projects/p/django-localflavor/

Note

django-localflavor does not accept contributions of country specific phone number fields. The django-phonenumber-field package has excellent support for validating phone numbers in many countries and we recommend this package.

Releases

django-localflavor releases follow semver with the major version number matching the major version number of Django (from Django 2.0 and above). A compatible version of django-localflavor will be released within one month of each Django release. django-localflavor may have additional releases if there are enough changes in between Django versions to justify a new version of django-localflavor. This means that the minor version number for django-localflavor may not match the minor version of Django itself. See the documentation about Django’s release process for more information.

Deprecation Policy

When non-internal parts of the project are deprecated a DeprecationWarning or a PendingDeprecationWarning will be thrown upon use until the next major version is released. The warning will explain how to safely update your code, and which version the functionality will be removed in. Deprecated code will be removed in releases with a new major version number (e.g. x.0 releases).

Backwards compatibility

We will always attempt to make localflavor reflect the officially gazetted policies of the appropriate local government authority. For example, if a government body makes a change to add, alter, or remove a province (or state, or county), that change will be reflected in localflavor in the next release.

When a backwards-incompatible change is made (for example, the removal or renaming of a province) the localflavor in question will raise a warning when that localflavor is imported. This provides a run-time indication that something may require attention.

However, once you have addressed the backwards compatibility (for example, auditing your code to see if any data migration is required), the warning serves no purpose. The warning can then be suppressed. For example, to suppress the warnings raised by the Indonesian localflavor you would use the following code:

import warnings
warnings.filterwarnings('ignore',
                        category=RuntimeWarning,
                        module='localflavor.id')
from localflavor.id import forms as id_forms

Indices and tables

Authors

  • Aaron Boman
  • Adam Taylor
  • Adnane Belmadiaf
  • Adonys Alea Boffill
  • Adrian Holovaty
  • Adrián Matejov
  • Agustín Scaramuzza
  • Ahmad Zolfaghari
  • Ahmed Shahwan
  • Alex Butum
  • Alexey Kotlyarov
  • Alex Gaynor
  • Alex Hill
  • Alex Zhang
  • Alix Martineau
  • Alonisser
  • Andreas Pelme
  • André Niero Setti
  • André Ramos
  • Andres Torres Marroquin
  • Andrew Godwin
  • Anton Zhyltsou
  • Arthur de Jong
  • Aymeric Augustin
  • babastienne
  • baffolobill
  • Baptiste Darthenay
  • Ben Davis
  • Ben Konrath
  • Bruno M. Custódio
  • Burhan Khalid
  • Claude Paroz
  • Daniel Ampuero
  • Daniela Ponader
  • Danielle Madeley
  • David Smith
  • Daniel Roschka
  • Didier ‘OdyX’ Raboud
  • Diederik van der Boor
  • d.merc
  • Dmitry Dygalo
  • Dominick Rivard
  • Douglas Miranda
  • Elliott Fawcett
  • Erik Romijn
  • Flavio Curella
  • Florian Apolloner
  • François Constant
  • Gary Wilson Jr
  • Gerardo Orozco
  • Ghassen Telmoudi
  • Gil Obradors
  • Grzes Furga
  • Hamad AlGhanim
  • Héctor Asencio
  • Henrik Ossipoff Hansen
  • Heri Priyatno
  • Honza Král
  • Horst Gutmann
  • Igor Támara
  • Illia Volochii
  • Ivan Fisun
  • Jaap Roes
  • Jacob Kaplan-Moss
  • James Bennett
  • Jannis Leidel
  • Jan Pieter Waagmeester
  • Jarmo van Lenthe
  • Jérémie Ferry
  • Jocelyn Delalande
  • Johannes Hoppe
  • Johnny Lee Othon
  • Jonas Ghyllebert
  • Joseph Kocherhans
  • Josh Crompton
  • Julien Phalip
  • Justin Bronn
  • Karen Tracey
  • Kevin Ramirez Zavalza
  • László Ratskó
  • Lefteris Nikoltsios
  • Luis Alberto Santana
  • Łukasz Langa
  • Luke Benstead
  • luyikei
  • Malcolm Tredinnick
  • Marco Beri
  • Martin Ogden
  • Marti Raudsepp
  • Matias Dinota
  • Michał Sałaban
  • Mike Lissner
  • Morgane Alonso
  • Naglis Jonaitis
  • Nishit Shah
  • Olivier Sels
  • Olle Vidner
  • Paul Cunnane
  • Paul Donohue
  • Paulo Poiati
  • Peter J. Farrell
  • Rael Max
  • Ramiro Morales
  • Raphael Michel
  • Rolf Erik Lekang
  • Russell Keith-Magee
  • Sandeep N
  • Serafeim Papastefanos
  • Sergio Oliveira
  • Simonas Kazlauskas
  • Simon Charette
  • Stefan Kjartansson
  • Syafiq Termizi
  • tadeo
  • Thiago Avelino
  • Thor K. Høgås
  • Tino de Bruijn
  • Tom Forbes
  • Trey Hunner
  • Tyler Ball
  • Vaclav Rehak
  • Venelin Stoykov
  • Vishal Pandey
  • Vladimir Nani
  • Abhineet Tamrakar

Changelog

4.0 (2023-04-22)

New flavors:

  • Nepal LocalFlavor: Support for Nepal added (gh-451).
  • Belarus localflavor (gh-422, gh-442).
  • Ghana localflavor (gh-460).

New fields for existing flavors:

  • Added fr.forms.FRRNAField models field (gh-443).
  • Added permanent account number(PAN) field in Indian flavor. (gh-457).
  • Added the Canadian Models fields. (gh-465).

Modifications to existing flavors:

  • Properly validate IBANs using BBAN to ensure invalid IBANs cannot be entered, updated IBAN_SEPA_COUNTRIES and IBAN_COUNTRY_CODE_LENGTH to latest data (gh-486).
  • Fix typo in Marijampolė county name in LTCountySelect (gh-480).
  • Add support for new Finnish identity codes (gh-478).
  • CIF spanish starting with ‘U’ bug resolved (gh-469).
  • Fix error code for BRPostalCodeValidator (gh-448).
  • Fix spelling of the India state of Chhattisgarh (gh-444).
  • Fix CURP regex for MX flavor (gh-449).
  • Change text based fields that inherited from django.forms.Field to inherit from django.forms.CharField. The following fields have been updated (gh-446):
    • at.forms.ATSocialSecurityNumberField
    • br.forms.BRStateChoiceField
    • ca.forms.CAProvinceField
    • ca.forms.CASocialInsuranceNumberField
    • ch.forms.CHIdentityCardNumberField
    • cu.forms.CUProvinceField
    • cu.forms.CURegionField
    • cz.forms.CZBirthNumberField
    • cz.forms.CZICNumberField
    • de.forms.DEIdentityCardNumberField
    • ee.forms.EEBusinessRegistryCode
    • ee.forms.EEPersonalIdentificationCode
    • fi.forms.FISocialSecurityNumber
    • gr.forms.GRTaxNumberCodeField
    • hr.forms.HRJMBAGField
    • hr.forms.HRJMBGField
    • hr.forms.HRLicensePlateField
    • hr.forms.HRPostalCodeField
    • id_.forms.IDLicensePlateField
    • id_.forms.IDNationalIdentityNumberField
    • id_.forms.IDPostCodeField
    • il.forms.ILIDNumberField
    • in_.forms.INAadhaarNumberField
    • in_.forms.INStateField
    • ir.forms.IRIDNumberField
    • it.forms.ITVatNumberField
    • lt.forms.LTPostalCodeField
    • lv.forms.LVPersonalCodeField
    • lv.forms.LVPostalCodeField
    • no.forms.NOSocialSecurityNumber
    • nz.forms.NZBankAccountNumberField
    • pt.forms.PTCitizenCardNumberField
    • pt.forms.PTSocialSecurityNumberField
    • ro.forms.ROCountyField
    • tr.forms.TRIdentificationNumberField
    • us.forms.USStateField
  • Removed inconvenient word VACA from CURP_INCONVENIENT_WORDS for MX flavor

Other changes:

  • Use ‘return value’ when value is in the empty_values list (gh-461).
  • Dropped support for Django 2.2, 3.0 and 3.1.
  • Dropped support for Python 3.5.
  • Added support for Python 3.10 and 3.11.

3.1 (2021-05-28)

Breaking data changes:

A schema and data migration are required for users of mx.models.MXStateField and mx.forms.MXStateSelect. The following steps are required:

  • run manage.py makemigrations to generate a schema migration
  • migrate DIF to CDMX with a data migration

A data migration is required for users of in_.models.INStateField and in_.forms.INStateSelect. The following data migrations are required:

  • Migrate CG to CT for Chattisgarh
  • Migrate UA to UT for Uttarakhand
  • Migrate DD and DN to DH for Dadra and Nagar Haveli and Daman and Diu

A warning message will be displayed when mx.models.MXStateField, mx.forms.MXStateSelect, in_.models.INStateField or in_.forms.INStateSelect are used. See the localflavor online docs for instructions on how to suppress this warning once the migration has been completed.

New flavors:

  • None

New fields for existing flavors:

  • None

Modifications to existing flavors:

  • Fix fr.forms.FRNationalIdentificationNumber validation for people born overseas (gh-415).
  • Breaking data change: Updated Indian states and union territories names and code as per iso 3166 (https://www.iso.org/obp/ui/#iso:code:3166:IN). The key for Chattisgarh has been changed from CG to CT, the key for Uttarakhand has been changed from UA to UT, and the keys DD (Dadra and Nagar Haveli) and DN (Daman and Diu) have been removed and combined into DH (Dadra and Nagar Haveli and Daman and Diu). Ladakh (LA) is the new addition in the Union Territories. There are also a few modifications in the States and Union Territories names: Orissa (OR) is now Odisha (OR), Pondicherry (PY) is now Puducherry (PY) Andaman and Nicobar (AN) is now Andaman and Nicobar Islands (AN). (gh-427).
  • Correct sorting of US_STATES to sort by full name rather than code (gh-424 gh-428).
  • Added new region for CL (gh-432, gh-433).
  • Updated IBAN validation for changes in IBAN Registry release 89, March 2021 (gh-436).
  • Breaking data change: mx.mx_states.STATE_CHOICES has been updated to change DIF/Distrito Federal to CDMX/Ciudad de México, the legal name for this state as of 29 January 2016 (gh-235, gh-400, gh-438).

Other changes:

  • Extended validation of BICs to match official SEPA regulations (gh-418).
  • Removed positional arguments (*args) from form fields that inherit from Django’s forms.CharField and forms.Field. Positional arguments are not supported in the the parent form and did not work gh-421).
  • Added error codes to all ValidationError`s as recommended by `Django’s form validation documentation (gh-440).
  • Renamed zh_CN and zh_TW locales to zh_Hans and zh_Hant respectively to match the Django locale names.

3.0 (2020-02-19)

Breaking changes:

Dropped support for Django < 2.2.

The deprecated generic.checksums.luhn and generic.checksums.ean functions have been removed in this release. Please use python-stdnum instead.

Some Icelandic postcodes in IS_POSTALCODES have had their spelling updated, and some entries have been removed entirely. A warning message will be displayed when is_.forms.ISPostalCodeSelect is used. See the localflavor online docs for instructions on how to suppress this warning once any incompatibilities have been dealt with.

A data migration is required for users of it.forms.ITRegionProvinceSelect. The CI, VS, OG, and OT keys need to be migrated to SU to account for the 2016 Italian provincial changes. Users wishing to maintain compatibility with the old provincial structure will need to create a custom version of it.forms.ITRegionProvinceSelect. A warning message will be displayed when it.forms.ITRegionProvinceSelect is used. See the localflavor online docs for instructions on how to suppress this warning once the migration has been completed.

Using positional arguments with fields that inherit from Django’s forms.RegexField previously only worked with Django 1.11 but were ignored with Django >= 2.0. Positional arguments have now been removed from all fields that inherit from Django’s forms.RegexField. Any options needed on the parent forms.RegexField, forms.CharField or forms.Field must now be set with keyword arguments.

New flavors:

  • Egypt local flavor
  • Malaysia local flavor

New fields for existing flavors:

  • None

Modifications to existing flavors:

  • Extended Danish DK_POSTALCODES with small Danish islands getting independent post code since 2017 (gh-380).
  • Switched incorrect ar.forms.ARCBUField implementation to use python-stdnum instead (gh-391).
  • Use set value of strip in fields that inherit from django.forms.CharField (gh-392):
    • gb.forms.GBPostcodeField
    • si.forms.SIEMSOField
    • si.forms.SITaxNumberField
    • za.forms.ZAIDField
  • Updated Icelandic IS_POSTALCODES with missing entries, updated spelling of entries, and removed non-existing ones. See breaking changes notice above (gh-394).
  • Add Kalimantan Utara in PROVINCE_CHOICES for Indonesia local flavor (gh-385).
  • Add validation for women National identity number for Indonesia localflavor (gh-386).
  • Updated ITRegionProvinceSelect for 2016 Italian provincial changes. See breaking changes notice above (gh-378, gh-402).
  • Use the value returned by clean() in the following fields (gh-401, gh-403):
    • ca.forms.CAProvinceField
    • ca.forms.CASocialInsuranceNumberField
    • ch.forms.CHIdentityCardNumberField
    • cl.forms.CLRutField
    • cn.forms.CNIDCardField
    • cu.forms.CURegionField
    • cu.forms.CUProvinceField
    • cz.forms.CZBirthNumberField
    • cz.forms.CZICNumberField
    • de.forms.DEIdentityCardNumberField
    • ee.forms.EEPersonalIdentificationCode
    • eg.forms.EGNationalIDNumberField
    • es.forms.ESIdentityCardNumberField
    • es.forms.ESCCCField
    • fi.forms.FISocialSecurityNumber
    • fr.forms.FRNationalIdentificationNumber
    • fr.forms.FRSIRENField
    • fr.forms.FRSIRETField
    • gr.forms.GRTaxNumberCodeField
    • gr.forms.GRSocialSecurityNumberCodeField
    • hr.forms.HRJMBGField
    • hr.forms.HROIBField
    • hr.forms.HRLicensePlateField
    • hr.forms.HRPostalCodeField
    • hr.forms.HRJMBAGField
    • id.forms.IDPostCodeField
    • id.forms.IDLicensePlateField
    • id.forms.IDNationalIdentityNumberField
    • kw.forms.KWCivilIDNumberField
    • lt.forms.LTIDCodeField
    • lv.forms.LVPersonalCodeField
    • no.forms.NOSocialSecurityNumber
    • nz.forms.NZBankAccountNumberField
    • pl.forms.PLPESELField
    • pl.forms.PLNationalIDCardNumberField
    • pl.forms.PLNIPField
    • pl.forms.PLREGONField
    • pt.forms.PTCitizenCardNumberField
    • pt.forms.PTSocialSecurityNumberField
    • ro.forms.ROCountyField
    • sg.forms.SGNRICFINField
    • si.forms.SIEMSOField
    • si.forms.SITaxNumberField
    • tr.forms.TRIdentificationNumberField
    • us.forms.USSocialSecurityNumberField
    • us.forms.USStateField
    • za.forms.ZAIDField
  • Removed unused positional arguments from fields that inherit from forms.RegexField (gh-405).

Other changes:

  • Removed deprecated generic.checksums.luhn and generic.checksums.ean functions (gh-379).

2.2 (2019-05-07)

All deprecated code will be removed in the next release (3.0). Please run you project’s tests using python -Wd so that deprecation warnings appear and can be addressed.

New flavors:

  • Added local flavor for Iran (gh-359).

New fields for existing flavors:

  • Added BRPostalCodeField, BRCPFField and BRCNPJField models fields (gh-365).
  • Added EircodeField in IE flavor (gh-360) (gh-366).
  • Added Models for Spain (ESPostalCodeField and ESIdentityCardNumberField) (gh-357) (gh-372).

Modifications to existing flavors:

  • Deprecated generic.checksums.luhn and generic.checksums.ean. Please use the python-stdnum library instead. (gh-370).

Other changes:

  • Added dependency on python-stdnum which is currently used for Luhn and EAN validation in several local-flavors (gh-370).
  • Added support for Vatican IBAN (gh-355).
  • Extended validation of BICs to check for the correct character set (gh-364).
  • Run tests for Django 2.2 and Python 3.5, 3.6 and 3.7 (gh-368).
  • Run tests for Django 2.0 and Python 3.7 (gh-368).

2.1 (2018-08-24)

New flavors:

  • Added local flavor for Moldova (gh-309).

New fields for existing flavors:

  • NLLicensePlateField in NL flavor (gh-327).
  • GRSocialSecurityNumberField (AMKA) in GR flavor (gh-337).

Modifications to existing flavors:

  • Allowed invalid message to be overridden in ESIdentityCardNumberField (gh-339).
  • Fix COFA validation for USStateField (gh-303)

Other changes:

  • Added VAT identification number validator for all EU locales (gh-324).
  • Fix EAN validation when intermediate checksum is 10 (gh-331).
  • Confirmed support for Django 2.1.
  • Added 34 as a valid CUIT prefix value for ARCUITField (gh-342).

2.0 (2017-12-30)

All deprecated code has been removed in this release. Specifically, all of the phone number fields have been removed and we recommend that you use django-phonenumber-field instead. If you need to use django-phonenumber-field with Django 2.0, you will need to use the version from the Django 2.0 support pull request until this pull request is merged.

A full list of the removed classes and functions is the “Other changes” section below.

New flavors:

  • None

New fields for existing flavors:

  • None

Modifications to existing flavors:

  • Changed RUT to NIT in CONITField form field error message.
  • Fixed validation of Czech birth numbers for birth dates after 1st January 1954 (gh-315).

Other changes:

  • Added support for Django 2.0 and dropped support for Django < 1.11 (gh-310).
  • Fixed README and changelog documentation about dropping Python 2 and Django 1.11.
  • Removed all deprecated classes, functions and associated data / regular expressions. These are the classes and functions that have been removed (gh-321):
    • au.forms.AUPhoneNumberField
    • au.models.AUPhoneNumberField
    • be.forms.BEPhoneNumberField
    • br.forms.BRPhoneNumberField
    • br.forms.DV_maker
    • ca.forms.CAPhoneNumberField
    • ch.forms.CHPhoneNumberField
    • cn.forms.CNPhoneNumberField
    • cn.forms.CNCellNumberField
    • dk.forms.DKPhoneNumberField
    • es.forms.ESPhoneNumberField
    • fr.forms.FRPhoneNumberField
    • gr.forms.GRPhoneNumberField
    • gr.forms.GRMobilePhoneNumberField
    • hk.forms.HKPhoneNumberField (localflavor.hk has been removed because it only contained this field)
    • hr.forms.HRPhoneNumberField
    • hr.forms.HRPhoneNumberPrefixSelect
    • id_.forms.IDPhoneNumberField
    • il.forms.ILMobilePhoneNumberField
    • in.forms.INPhoneNumberField
    • is_.forms.ISPhoneNumberField
    • it.forms.ITPhoneNumberField
    • lt.forms.LTPhoneField
    • nl.forms.NLPhoneNumberField
    • nl.forms.NLSoFiNumberField
    • nl.models.NLBankAccountNumberField
    • nl.models.NLPhoneNumberField
    • nl.models.NLSoFiNumberField
    • nl.validators.NLBankAccountNumberFieldValidator
    • nl.validators.NLPhoneNumberFieldValidator
    • nl.validators.NLSoFiNumberFieldValidator
    • no.forms.NOPhoneNumberField
    • nz.forms.NZPhoneNumberField
    • pk.forms.PKPhoneNumberField
    • pk.models.PKPhoneNumberField
    • pt.forms.PTPhoneNumberField
    • ro.forms.ROIBANField
    • ro.forms.ROPhoneNumberField
    • sg.forms.SGPhoneNumberField
    • sg.forms.SGNRIC_FINField
    • si.forms.SIPhoneNumberField
    • tr.forms.TRPhoneNumberField
    • us.forms.USPhoneNumberField
    • us.models.PhoneNumberField

1.6 (2017-11-22)

All deprecated code will be removed in the next release. Please run you project’s tests using python -Wd so that deprecation warnings appear and can be addressed.

New flavors:

  • Added local flavor for Cuba (gh-292).

New fields for existing flavors:

  • Added KWAreaSelect form field (gh-296).
  • Added CONITField form field (gh-145).
  • Added nl.models.NLBSNField, nl.forms.NLBSNFormField and nl.validators.NLBSNFieldValidator (gh-314).

Modifications to existing flavors:

  • Fixed crash with USZipCodeField form validation when null=True is allowed (gh-295).
  • Deprecated br.forms.DV_maker, sg.forms.SGNRIC_FINField, lt.forms.LTPhoneField and ro.forms.ROIBANField (gh-305).
  • Added support for Swedish interim personal identity numbers (gh-308).
  • Deprecated nl.models.NLBankAccountNumberField (gh-307).
  • Updated IBANField to support the latest additions to the IBAN Registry (version 78 / August 2017).
  • Deprecated nl.models.NLSoFiNumberField, nl.forms.NLSoFiNumberField and nl.validators.NLSoFiNumberFieldValidator (gh-314).
  • Fixes issue with no.forms.NOBankAccountNumber unclean data (gh-311).

Other changes:

  • Added support for empty_value kwarg in Django >= 1.11 (gh-298).
  • Dropped support for Python 3.2.

1.5 (2017-05-26)

New flavors:

  • Added local flavor for Ukraine (gh-273).

New fields for existing flavors:

  • Added NOBankAccountNumber form field (gh-275).
  • Added AUCompanyNumberField model and form field (gh-278).

Modifications to existing flavors:

  • Added normalized versions of COFA state names for US (gh-277).
  • Fixed Dutch NLZipCodeField field not to store empty value as a single space (gh-280).
  • Fixed validation for old Australian tax file numbers (gh-284).

Other changes:

  • None

1.4 (2017-01-03)

New flavors:

  • Added local flavor for Venezuela (gh-245).
  • Added local flavor for Morocco (gh-270).

New fields for existing flavors:

  • Added MXCLABEField model and form fields (gh-227).
  • Added AUTaxFileNumberField model and form fields (gh-238).
  • Added KWGovernorateSelect field to easily select Kuwait governorates. (gh-231).
  • Added FRRegion2016Select field to stick to current legislation (gh-260). and (gh-268).

Modifications to existing flavors:

  • Enhancements of localflavor.br.forms.BRCNPJField (gh-240 gh-254).
  • Fixed century bug with Kuwait Civil ID verification localflavor.kw.forms (gh-195).
  • Allow passing field name as first positional argument of IBANField (gh-236).
  • Fixed French FRNationalIdentificationNumber bug with imaginary birth month values (gh-242).
  • Fixed French FRNationalIdentificationNumber bug with corsican people born after 2000 (gh-242).
  • Fixed the translation for US state ‘Georgia’ from colliding with the country ‘Georgia’ (gh-250).
  • Fixed the styling errors and enabled prospector (gh-259).
  • Allow AU ABN value with spaces to validate (gh-266 gh-267).

Other changes:

  • Drop support for Django 1.7 (gh-218).
  • Ensure the migration framework generates schema migrations for model fields that change the max_length (gh-257). Users will need to generate migrations for any model fields they use with ‘makemigrations’.
  • Lazily generate US_STATES, STATE_CHOICES, and USPS_CHOICES (gh-203 gh-272).
  • Deprecated Phone Number fields (gh-262).
  • Bumped versions of requirements for testing (gh-274).

1.3 (2016-05-06)

New flavors:

  • Added local flavor for Bulgaria (gh-191).
  • Added local flavor for Tunisia (gh-141).
  • Added local flavor for Hungary (gh-213).

New fields for existing flavors:

  • Added ARCBUField form field. (gh-151).
  • Added NLZipCodeField, NLProvinceField, NLSoFiNumberField, NLPhoneNumberField model fields (gh-152).
  • Added AUBusinessNumberField model and form fields (gh-63).

Modifications to existing flavors:

  • Moved Dutch validators from localflavor.nl.forms to localflavor.nl.validators (gh-152).
  • Fix check for promotional social security numbers in USSocialSecurityNumberField (gh-157).
  • Updated IBANField to support the latest additions to the IBAN Registry (version 64 / March 2016).
  • Fix bug with MXRFCField where some incorrect values would validate correctly. (gh-204).
  • Fixed bug with IBANFormField validation. (gh-215).
  • Update regex in DEZipCodeField to prohibit invalid postal codes. (gh-216).
  • Added deconstructor methods to validators. (gh-220).
  • Fix bug in ESIdentityCardNumberField where some valid values for NIE numbers were not validating (gh-217).
  • Add deconstruct method to all model fields (gh-162 gh-224).

Other changes:

  • Drop support for Django 1.5, Django 1.6 and Python 2.6 (gh-170).

1.2 (2015-11-27)

New flavors:

  • None

New fields for existing flavors:

  • Added form field for Estonian business registration codes (gh-135).
  • Added model field for Ecuadorian provinces (gh-138).
  • Added form field for Swiss Social Security numbers ( (gh-155).
  • Added form field for Brazilian Legal Process numbers (Processo) (gh-163).

Modifications to existing flavors:

  • Fixed misspelled Polish administrative unit names (gh-136).
  • Added Kosovo and Timor-Leste to list of IBAN countries (gh-139).
  • Fixed error in Romanian fiscal identity code (CIF) field when value has a trailing slash (gh-146).
  • Updated validation in Swiss postal code field to only accept values in the range 1000 - 9000 (gh-154).
  • Added validator for International Article Number (EAN) to the generic module (gh-156).
  • Updated Italian social security number field to use ‘tax code’ in error message (gh-167).
  • Fixed error in Greek tax number code field when value has only alpha characters (gh-171).
  • Added stricter validation in the Brazilian Cadastro de Pessoas Físicas (CPF) field (gh-172).
  • Corrected Romanian counties choice names to use ș and ț (comma below) (gh-175).
  • Updated Brazilian postal code field to also accept values with XX.XXX-XXX and XXXXXXXX formats (gh-177).
  • Marked US state names for translation (gh-178).
  • Fixed French national identification number validation for people born before 1976 in Corsica (gh-186).

1.1 (2014-12-10)

New flavors:

  • Added local flavor for Denmark (gh-83)
  • Added local flavor for Estonia (gh-70)
  • Added local flavor for Latvia (gh-68)
  • Added local flavor for Malta (gh-88)
  • Added local flavor for Pakistan (gh-41)
  • Added local flavor for Singapore (gh-119)

New fields for existing flavors:

  • Added model and form fields for French SIREN/SIRET numbers (gh-123)
  • Added model field for states of Brazil (gh-22)
  • Added form field for Indian Aadhaar numbers (gh-23)
  • Added model field for states of India (gh-23)
  • Added form field for Lithuanian phone numbers
  • Added model field for Dutch bank accounts (gh-42)
  • Added form field for Italian phone numbers (gh-74)
  • Added form field for French National Identification Number (gh-75)
  • Added IBAN model and form fields (gh-86)
  • Added BIC model and form fields (gh-125)
  • Added SSN model field for US (gh-96)
  • Added ZIP code model field for US (gh-55)

Other modifications to existing flavors:

  • backward incompatible Updated the region lists of Great Britain (gh-43, gh-126)
  • Added Ceuta and Mellila to regions of Spain (gh-8)
  • Added support entities in Italian SSN form field (gh-20)
  • Added Japanese prefecture codes and fix prefecture order (gh-27)
  • Added normalization for Lithuanian postal code field (gh-69)
  • Added whitespace stripping whitespace from US ZIP code field (gh-77)
  • Added an option for customizing French form field labels (gh-102)
  • Added mapping between provinces and regions for Italy (gh-105)
  • Added Telengana to states of India (gh-107)
  • Added support for 14X and 17X Chinese cell numbers (gh-17, gh-120)
  • Allowed spaces in CPF numbers for Brazil (gh-32)
  • Fixed CIF validation for Spain (gh-78)
  • Fixed armed forces “states” for US (gh-8)
  • Fixed REGON number validation for Poland (gh-62)
  • Rejected US SSN starting with 9 (gh-35)
  • Rejected Brazilian CPF number when all numbers all numbers are equal (gh-103)
  • Added ‘Y’ to the NIE number validation for Spain (gh-127)
  • Updated Argentina’s CUIT number validation to support legal types 24 and 33 (gh-121)
  • Added ‘R’, ‘V’ and ‘W’ to the Spanish identity card number validation (gh-132)

Other changes:

  • Added checksums module (from Django) providing a Luhn validator (gh-122)

1.0 (2013-07-29)

Initial release

Argentina (ar)

AR-specific Form helpers.

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

This field validates a CBU (Clave Bancaria Uniforme).

A CBU is a 22-digits long number. The first 8 digits denote bank and branch number, plus a verifying digit. The remaining 14 digits denote an account number, plus a verifying digit.

More info: https://es.wikipedia.org/wiki/Clave_Bancaria_Uniforme

New in version 1.3.

Changed in version 3.0.

clean(value)[source]

Value must be a 22 digits long number.

class localflavor.ar.forms.ARCUITField(**kwargs)[source]

This field validates a CUIT (Código Único de Identificación Tributaria).

A CUIT is of the form XX-XXXXXXXX-V. The last digit is a check digit.

More info: http://es.wikipedia.org/wiki/Clave_%C3%9Anica_de_Identificaci%C3%B3n_Tributaria

Info in English: http://www.justlanded.com/english/Argentina/Argentina-Guide/Visas-Permits/Other-Legal-Documents

Changed in version 2.1: ARCUITField now also accepts CUIT with prefix 34.

clean(value)[source]

Value can be either a string in the format XX-XXXXXXXX-X or an 11-digit number.

class localflavor.ar.forms.ARDNIField(max_length=10, min_length=7, **kwargs)[source]

A field that validates ‘Documento Nacional de Identidad’ (DNI) numbers.

clean(value)[source]

Value can be a string either in the [X]X.XXX.XXX or [X]XXXXXXX formats.

class localflavor.ar.forms.ARPostalCodeField(max_length=8, min_length=4, **kwargs)[source]

A field that accepts a ‘classic’ NNNN Postal Code or a CPA.

See:

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.ar.forms.ARProvinceSelect(attrs=None)[source]

A Select widget that uses a list of Argentinean provinces/autonomous cities as its choices.

localflavor.ar.ar_provinces.PROVINCE_CHOICES = (('B', 'Buenos Aires'), ('K', 'Catamarca'), ('H', 'Chaco'), ('U', 'Chubut'), ('C', 'Ciudad Autónoma de Buenos Aires'), ('X', 'Córdoba'), ('W', 'Corrientes'), ('E', 'Entre Ríos'), ('P', 'Formosa'), ('Y', 'Jujuy'), ('L', 'La Pampa'), ('F', 'La Rioja'), ('M', 'Mendoza'), ('N', 'Misiones'), ('Q', 'Neuquén'), ('R', 'Río Negro'), ('A', 'Salta'), ('J', 'San Juan'), ('D', 'San Luis'), ('Z', 'Santa Cruz'), ('S', 'Santa Fe'), ('G', 'Santiago del Estero'), ('V', 'Tierra del Fuego, Antártida e Islas del Atlántico Sur'), ('T', 'Tucumán'))

A list of Argentinean provinces and autonomous cities as choices in a formfield. From http://www.argentina.gov.ar/argentina/portal/paginas.dhtml?pagina=425

Austria (at)

AT-specific Form helpers.

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

Austrian Social Security numbers are composed of a 4 digits and 6 digits field.

The latter represents in most cases the person’s birthdate while the first 4 digits represent a 3-digits counter and a one-digit checksum.

The 6-digits field can also differ from the person’s birthdate if the 3-digits counter suffered an overflow.

This code is based on information available on http://de.wikipedia.org/wiki/Sozialversicherungsnummer#.C3.96sterreich

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.at.forms.ATStateSelect(attrs=None)[source]

A Select widget that uses a list of AT states as its choices.

class localflavor.at.forms.ATZipCodeField(**kwargs)[source]

A form field that validates its input is an Austrian postcode.

Accepts 4 digits (first digit must be greater than 0).

localflavor.at.at_states.STATE_CHOICES = (('BL', 'Burgenland'), ('KA', 'Carinthia'), ('NO', 'Lower Austria'), ('OO', 'Upper Austria'), ('SA', 'Salzburg'), ('ST', 'Styria'), ('TI', 'Tyrol'), ('VO', 'Vorarlberg'), ('WI', 'Vienna'))

A list of Austrian states according to https://en.wikipedia.org/wiki/States_of_Austria

Australia (au)

Forms

Australian-specific Form helpers.

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

A form field that validates input as an Australian Business Number (ABN).

New in version 1.3.

Changed in version 1.4.

prepare_value(value)[source]

Format the value for display.

to_python(value)[source]

Return a string.

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

A form field that validates input as an Australian Company Number (ACN).

New in version 1.5.

prepare_value(value)[source]

Format the value for display.

to_python(value)[source]

Return a string.

class localflavor.au.forms.AUPostCodeField(max_length=4, **kwargs)[source]

Australian post code field.

Assumed to be 4 digits. Northern Territory 3-digit postcodes should have leading zero.

class localflavor.au.forms.AUStateSelect(attrs=None)[source]

A Select widget that uses a list of Australian states/territories as its choices.

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

A form field that validates input as an Australian Tax File Number (TFN).

New in version 1.4.

prepare_value(value)[source]

Format the value for display.

Models

class localflavor.au.models.AUBusinessNumberField(*args, **kwargs)[source]

A model field that checks that the value is a valid Australian Business Number (ABN).

New in version 1.3.

description = 'Australian Business Number'
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value)[source]

Ensure the ABN is stored without spaces.

validators = [<localflavor.au.validators.AUBusinessNumberFieldValidator object>, <django.core.validators.MaxLengthValidator object>]
class localflavor.au.models.AUCompanyNumberField(*args, **kwargs)[source]

A model field that checks that the value is a valid Australian Company Number (ACN).

New in version 1.5.

description = 'Australian Company Number'
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value)[source]

Ensure the ACN is stored without spaces.

validators = [<localflavor.au.validators.AUCompanyNumberFieldValidator object>, <django.core.validators.MaxLengthValidator object>]
class localflavor.au.models.AUPostCodeField(*args, **kwargs)[source]

A model field that stores the four-digit Australian postcode in the database.

This field is represented by forms as a AUPostCodeField field.

description = 'Australian Postcode'
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.au.models.AUStateField(*args, **kwargs)[source]

A model field that stores the three-letter Australian state abbreviation in the database.

It is represented with STATE_CHOICES` choices.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

description = 'Australian State'
class localflavor.au.models.AUTaxFileNumberField(*args, **kwargs)[source]

A model field that checks that the value is a valid Tax File Number (TFN).

A TFN is a number issued to a person by the Commissioner of Taxation and is used to verify client identity and establish their income levels. It is a eight or nine digit number without any embedded meaning.

New in version 1.4.

description = 'Australian Tax File Number'
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value)[source]

Ensure the TFN is stored without spaces.

validators = [<localflavor.au.validators.AUTaxFileNumberFieldValidator object>, <django.core.validators.MaxLengthValidator object>]

Data

localflavor.au.au_states.STATE_CHOICES = (('ACT', 'Australian Capital Territory'), ('NSW', 'New South Wales'), ('NT', 'Northern Territory'), ('QLD', 'Queensland'), ('SA', 'South Australia'), ('TAS', 'Tasmania'), ('VIC', 'Victoria'), ('WA', 'Western Australia'))

An alphabetical list of states for use as choices in a formfield.

Belgium (be)

Forms

Belgium-specific Form helpers.

class localflavor.be.forms.BEPostalCodeField(**kwargs)[source]

A form field that validates its input as a belgium postal code.

Belgium postal code is a 4 digits string. The first digit indicates the province (except for the 3ddd numbers that are shared by the eastern part of Flemish Brabant and Limburg and the and 1ddd that are shared by the Brussels Capital Region, the western part of Flemish Brabant and Walloon Brabant)

class localflavor.be.forms.BEProvinceSelect(attrs=None)[source]

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

class localflavor.be.forms.BERegionSelect(attrs=None)[source]

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

Data

localflavor.be.be_provinces.PROVINCE_CHOICES = (('VAN', 'Antwerp'), ('BRU', 'Brussels'), ('VOV', 'East Flanders'), ('VBR', 'Flemish Brabant'), ('WHT', 'Hainaut'), ('WLG', 'Liege'), ('VLI', 'Limburg'), ('WLX', 'Luxembourg'), ('WNA', 'Namur'), ('WBR', 'Walloon Brabant'), ('VWV', 'West Flanders'))

ISO codes

localflavor.be.be_regions.REGION_CHOICES = (('BRU', 'Brussels Capital Region'), ('VLG', 'Flemish Region'), ('WAL', 'Wallonia'))

ISO codes

Bulgaria (bg)

Validators

class localflavor.bg.validators.EGNValidator[source]

Check Bulgarian unique citizenship number (EGN) for validity.

More details https://en.wikipedia.org/wiki/Unique_citizenship_number Full information in Bulgarian about algorithm is available here http://www.grao.bg/esgraon.html#section2

deconstruct()

Return a 3-tuple of class import path, positional arguments, and keyword arguments.

class localflavor.bg.validators.EIKValidator[source]

Check Bulgarian EIK/BULSTAT codes for validity.

Full information in Bulgarian about algorithm is available here http://bulstat.registryagency.bg/About.html

deconstruct()

Return a 3-tuple of class import path, positional arguments, and keyword arguments.

Model Fields

class localflavor.bg.models.BGEGNField(*args, **kwargs)[source]

Field that stores Bulgarian unique citizenship number (EGN).

This is shortcut for:

models.CharField(max_length=10, validators=[localflavor.bg.validators.egn_validator])
class localflavor.bg.models.BGEIKField(*args, **kwargs)[source]

Field that stores Bulgarian EIK/BULSTAT codes.

This is shortcut for:

models.CharField(max_length=13, validators=[localflavor.bg.validators.eik_validator])

Utils

localflavor.bg.utils.get_egn_birth_date(egn)[source]

Extract birth date from Bulgarian unique citizenship number (EGN).

More details https://en.wikipedia.org/wiki/Unique_citizenship_number Information in Bulgarian for this can be found here http://www.grao.bg/esgraon.html#section2

Brazil (br)

Forms

BR-specific Form helpers.

class localflavor.br.forms.BRCNPJField(min_length=14, max_length=18, **kwargs)[source]

A form field that validates input as Brazilian CNPJ.

Input can either be of the format XX.XXX.XXX/XXXX-XX or be a group of 14 digits.

If you want to use the long format only, you can specify:
brcnpj_field = BRCNPJField(min_length=16)
If you want to use the short format, you can specify:
brcnpj_field = BRCNPJField(max_length=14)

Otherwise both formats will be valid.

Changed in version 1.4.

Changed in version 2.2: Use BRCNPJValidator to centralize validation logic and share with equivalent model field. More details at: https://github.com/django/django-localflavor/issues/334

class localflavor.br.forms.BRCPFField(max_length=14, min_length=11, **kwargs)[source]

A form field that validates a CPF number or a CPF string.

A CPF number is compounded by XXX.XXX.XXX-VD. The two last digits are check digits.

More information: http://en.wikipedia.org/wiki/Cadastro_de_Pessoas_F%C3%ADsicas

Changed in version 2.2: Use BRCPFValidator to centralize validation logic and share with equivalent model field. More details at: https://github.com/django/django-localflavor/issues/334

class localflavor.br.forms.BRProcessoField(max_length=25, min_length=20, **kwargs)[source]

A form field that validates a Legal Process(Processo) number or a Legal Process string.

A Processo number is compounded by NNNNNNN-DD.AAAA.J.TR.OOOO. The two DD digits are check digits. More information: http://www.cnj.jus.br/busca-atos-adm?documento=2748

New in version 1.2.

clean(value)[source]

Value can be either a string in the format NNNNNNN-DD.AAAA.J.TR.OOOO or an 20-digit number.

class localflavor.br.forms.BRStateChoiceField(**kwargs)[source]

A choice field that uses a list of Brazilian states as its choices.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.br.forms.BRStateSelect(attrs=None)[source]

A Select widget that uses a list of Brazilian states/territories as its choices.

class localflavor.br.forms.BRZipCodeField(**kwargs)[source]

A form field that validates input as a Brazilian zip code, with the format 00000-000.

Changed in version 2.2: Use BRPostalCodeValidator to centralize validation logic and share with equivalent model field. More details at: https://github.com/django/django-localflavor/issues/334

Models

class localflavor.br.models.BRCNPJField(*args, **kwargs)[source]

A model field for the brazilian document named of CNPJ (Cadastro Nacional de Pessoa Jurídica)

New in version 2.2.

class localflavor.br.models.BRCPFField(*args, **kwargs)[source]

A model field for the brazilian document named of CPF (Cadastro de Pessoa Física)

New in version 2.2.

class localflavor.br.models.BRPostalCodeField(*args, **kwargs)[source]

A model field for the brazilian zip code

New in version 2.2.

class localflavor.br.models.BRStateField(*args, **kwargs)[source]

A model field for states of Brazil.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

Data

localflavor.br.br_states.STATE_CHOICES = (('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PA', 'Pará'), ('PB', 'Paraíba'), ('PR', 'Paraná'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SP', 'São Paulo'), ('SE', 'Sergipe'), ('TO', 'Tocantins'))

An alphabetical list of Brazilian states for use as choices in a formfield

Canada (ca)

Forms

Canada-specific Form helpers.

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

Canadian postal code form field.

Validates against known invalid characters: D, F, I, O, Q, U Additionally the first character cannot be Z or W. For more info see: http://www.canadapost.ca/tools/pg/manual/PGaddress-e.asp#1402170

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

A form field that validates its input is a Canadian province name or abbreviation.

It normalizes the input to the standard two-leter postal service abbreviation for the given province.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.ca.forms.CAProvinceSelect(attrs=None)[source]

A Select widget that uses a list of Canadian provinces and territories as its choices.

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

A Canadian Social Insurance Number (SIN).

Checks the following rules to determine whether the number is valid:

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Models

class localflavor.ca.models.CAPostalCodeField(*args, **kwargs)[source]

A model field that stores the Canadian Postal code in the database.

Forms represent it as a CAPostalCodeField field.

New in version 4.0.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.ca.models.CAProvinceField(*args, **kwargs)[source]

A model field that stores the two-letter Canadian province abbreviation in the database.

Forms represent it as a forms.CAProvinceField field.

New in version 4.0.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

class localflavor.ca.models.CASocialInsuranceNumberField(*args, **kwargs)[source]

A model field that stores a Canadian Social Insurance Number (SIN) in the format XXX-XXX-XXX.

Forms represent it as forms.CASocialInsuranceNumberField field.

New in version 4.0.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

Data

localflavor.ca.ca_provinces.PROVINCE_CHOICES = (('AB', 'Alberta'), ('BC', 'British Columbia'), ('MB', 'Manitoba'), ('NB', 'New Brunswick'), ('NL', 'Newfoundland and Labrador'), ('NT', 'Northwest Territories'), ('NS', 'Nova Scotia'), ('NU', 'Nunavut'), ('ON', 'Ontario'), ('PE', 'Prince Edward Island'), ('QC', 'Quebec'), ('SK', 'Saskatchewan'), ('YT', 'Yukon'))

An alphabetical list of provinces and territories for use as choices in a formfield. Source: http://www.canada.gc.ca/othergov/prov_e.html

localflavor.ca.ca_provinces.PROVINCES_NORMALIZED = {'ab': 'AB', 'alberta': 'AB', 'b.c.': 'BC', 'bc': 'BC', 'british columbia': 'BC', 'manitoba': 'MB', 'mb': 'MB', 'nb': 'NB', 'new brunswick': 'NB', 'newfoundland': 'NL', 'newfoundland and labrador': 'NL', 'nf': 'NL', 'nl': 'NL', 'northwest territories': 'NT', 'nova scotia': 'NS', 'ns': 'NS', 'nt': 'NT', 'nu': 'NU', 'nunavut': 'NU', 'on': 'ON', 'ontario': 'ON', 'p.e.i.': 'PE', 'pe': 'PE', 'pei': 'PE', 'pq': 'QC', 'prince edward island': 'PE', 'qc': 'QC', 'quebec': 'QC', 'saskatchewan': 'SK', 'sk': 'SK', 'yk': 'YT', 'yt': 'YT', 'yukon': 'YT', 'yukon territory': 'YT'}

a mapping of province misspellings/abbreviations to normalized abbreviations

Switzerland (ch)

Forms

Swiss-specific Form helpers.

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

A Swiss identity card number.

Checks the following rules to determine whether the number is valid:

  • Conforms to the X1234567<0 or 1234567890 format.
  • Included checksums match calculated checksums
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

A Swiss Social Security number (also known as the new AHV Number).

Checks the following rules to determine whether the number is valid:

  • Conforms to the 756.XXXX.XXXX.XX
  • Included checksums match calculated checksums

See: http://de.wikipedia.org/wiki/Sozialversicherungsnummer#Versichertennummer

New in version 1.2.

class localflavor.ch.forms.CHStateSelect(attrs=None)[source]

A Select widget that uses a list of CH states as its choices.

class localflavor.ch.forms.CHZipCodeField(**kwargs)[source]

A form field that validates input as a Swiss zip code.

Valid codes consist of four digits ranging from 1XXX to 9XXX.

See: http://en.wikipedia.org/wiki/Postal_codes_in_Switzerland_and_Liechtenstein

Data

localflavor.ch.ch_states.STATE_CHOICES = (('AG', 'Aargau'), ('AI', 'Appenzell Innerrhoden'), ('AR', 'Appenzell Ausserrhoden'), ('BS', 'Basel-Stadt'), ('BL', 'Basel-Land'), ('BE', 'Berne'), ('FR', 'Fribourg'), ('GE', 'Geneva'), ('GL', 'Glarus'), ('GR', 'Graubuenden'), ('JU', 'Jura'), ('LU', 'Lucerne'), ('NE', 'Neuchatel'), ('NW', 'Nidwalden'), ('OW', 'Obwalden'), ('SH', 'Schaffhausen'), ('SZ', 'Schwyz'), ('SO', 'Solothurn'), ('SG', 'St. Gallen'), ('TG', 'Thurgau'), ('TI', 'Ticino'), ('UR', 'Uri'), ('VS', 'Valais'), ('VD', 'Vaud'), ('ZG', 'Zug'), ('ZH', 'Zurich'))

An alphabetical list of states

Chile (cl)

Forms

Chile specific form helpers.

class localflavor.cl.forms.CLRegionSelect(attrs=None)[source]

A Select widget that uses a list of Chilean Regions (Regiones) as its choices.

class localflavor.cl.forms.CLRutField(**kwargs)[source]

Chilean “Rol Unico Tributario” (RUT) field.

This is the Chilean national identification number.

Samples for testing are available from https://palena.sii.cl/cvc/dte/ee_empresas_emisoras.html

clean(value)[source]

Check and clean the Chilean RUT.

Data

localflavor.cl.cl_regions.REGION_CHOICES = (('RM', 'Región Metropolitana de Santiago'), ('I', 'Región de Tarapacá'), ('II', 'Región de Antofagasta'), ('III', 'Región de Atacama'), ('IV', 'Región de Coquimbo'), ('V', 'Región de Valparaíso'), ('VI', "Región del Libertador Bernardo O'Higgins"), ('VII', 'Región del Maule'), ('VIII', 'Región del Bío Bío'), ('IX', 'Región de la Araucanía'), ('X', 'Región de los Lagos'), ('XI', 'Región de Aysén del General Carlos Ibáñez del Campo'), ('XII', 'Región de Magallanes y la Antártica Chilena'), ('XIV', 'Región de Los Ríos'), ('XV', 'Región de Arica-Parinacota'), ('XVI', 'Región del Ñuble'))

A list of Chilean regions as choices in a formfield.

China (cn)

Forms

China(mainland)-specific Form helpers.

class localflavor.cn.forms.CNProvinceSelect(attrs=None)[source]

A select widget providing the list of provinces and districts in People’s Republic of China as choices.

class localflavor.cn.forms.CNPostCodeField(**kwargs)[source]

A form field that validates input as postal codes in mainland China.

Valid codes are in the format of XXXXXX where X is a digit.

class localflavor.cn.forms.CNIDCardField(max_length=18, min_length=15, **kwargs)[source]

A form field that validates input as a Resident Identity Card (PRC) number.

This field would check the following restrictions:
  • the length could only be 15 or 18;
  • if the length is 18, the last character can be x or X;
  • has a valid checksum (only for those with a length of 18);
  • has a valid date of birth;
  • has a valid province.

The checksum algorithm is described in GB11643-1999. See: http://en.wikipedia.org/wiki/Resident_Identity_Card#Identity_card_number

clean(value)[source]

Check whether the input is a valid ID Card Number.

has_valid_birthday(value)[source]

This method grabs the date of birth from the ID card number and test whether it is a valid date.

has_valid_checksum(value)[source]

This method checks if the last letter/digit is valid according to GB11643-1999.

has_valid_location(value)[source]

This method checks if the first two digits in the ID Card are valid province code.

Data

localflavor.cn.cn_provinces.CN_PROVINCE_CHOICES = (('anhui', '安徽'), ('beijing', '北京'), ('chongqing', '重庆'), ('fujian', '福建'), ('gansu', '甘肃'), ('guangdong', '广东'), ('guangxi', '广西壮族自治区'), ('guizhou', '贵州'), ('hainan', '海南'), ('hebei', '河北'), ('heilongjiang', '黑龙江'), ('henan', '河南'), ('hongkong', '香港'), ('hubei', '湖北'), ('hunan', '湖南'), ('jiangsu', '江苏'), ('jiangxi', '江西'), ('jilin', '吉林'), ('liaoning', '辽宁'), ('macao', '澳门'), ('neimongol', '内蒙古自治区'), ('ningxia', '宁夏回族自治区'), ('qinghai', '青海'), ('shaanxi', '陕西'), ('shandong', '山东'), ('shanghai', '上海'), ('shanxi', '山西'), ('sichuan', '四川'), ('taiwan', '台湾'), ('tianjin', '天津'), ('xinjiang', '新疆维吾尔自治区'), ('xizang', '西藏自治区'), ('yunnan', '云南'), ('zhejiang', '浙江'))

An alphabetical list of provinces for use as choices in a formfield. http://en.wikipedia.org/wiki/ISO_3166-2:CN http://en.wikipedia.org/wiki/Province_%28China%29 http://en.wikipedia.org/wiki/Direct-controlled_municipality http://en.wikipedia.org/wiki/Autonomous_regions_of_China

Colombia (co)

Forms

Colombian-specific form helpers.

class localflavor.co.forms.CODepartmentSelect(attrs=None)[source]

A Select widget that uses a list of Colombian states as its choices.

class localflavor.co.forms.CONITField(**kwargs)[source]

This field validates a NIT (NUmero de IdentificaciOn Tributaria). A NIT is of the form XXXXXXXXXX-V. The last digit is a check digit. This field can be used for people and companies.

More info: http://es.wikipedia.org/wiki/N%C3%BAmero_de_Identificaci%C3%B3n_Tributaria

clean(value)[source]

Value can be either a string in the format XXXXXXXXXX-Y or XXXXXXXXXXY.

Data

localflavor.co.co_departments.DEPARTMENT_CHOICES = (('AMA', 'Amazonas'), ('ANT', 'Antioquia'), ('ARA', 'Arauca'), ('ATL', 'Atlántico'), ('DC', 'Bogotá'), ('BOL', 'Bolívar'), ('BOY', 'Boyacá'), ('CAL', 'Caldas'), ('CAQ', 'Caquetá'), ('CAS', 'Casanare'), ('CAU', 'Cauca'), ('CES', 'Cesar'), ('CHO', 'Chocó'), ('COR', 'Córdoba'), ('CUN', 'Cundinamarca'), ('GUA', 'Guainía'), ('GUV', 'Guaviare'), ('HUI', 'Huila'), ('LAG', 'La Guajira'), ('MAG', 'Magdalena'), ('MET', 'Meta'), ('NAR', 'Nariño'), ('NSA', 'Norte de Santander'), ('PUT', 'Putumayo'), ('QUI', 'Quindío'), ('RIS', 'Risaralda'), ('SAP', 'San Andrés and Providencia'), ('SAN', 'Santander'), ('SUC', 'Sucre'), ('TOL', 'Tolima'), ('VAC', 'Valle del Cauca'), ('VAU', 'Vaupés'), ('VID', 'Vichada'))

A list of Colombian departaments as choices in a formfield.

Czech Republic (cz)

Forms

Czech-specific form helpers.

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

Czech birth number form field.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

Czech IC number form field.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.cz.forms.CZPostalCodeField(**kwargs)[source]

A form field that validates its input as Czech postal code.

Valid form is XXXXX or XXX XX, where X represents integer.

clean(value)[source]

Validates the input and returns a string that contains only numbers.

Returns an empty string for empty values.

class localflavor.cz.forms.CZRegionSelect(attrs=None)[source]

A select widget widget with list of Czech regions as choices.

Data

localflavor.cz.cz_regions.REGION_CHOICES = (('PR', 'Prague'), ('CE', 'Central Bohemian Region'), ('SO', 'South Bohemian Region'), ('PI', 'Pilsen Region'), ('CA', 'Carlsbad Region'), ('US', 'Usti Region'), ('LB', 'Liberec Region'), ('HK', 'Hradec Region'), ('PA', 'Pardubice Region'), ('VY', 'Vysocina Region'), ('SM', 'South Moravian Region'), ('OL', 'Olomouc Region'), ('ZL', 'Zlin Region'), ('MS', 'Moravian-Silesian Region'))

Czech regions, translations get from http://www.crwflags.com/fotw/Flags/cz-re.html

Germany (de)

Forms

DE-specific Form helpers.

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

A German identity card number.

Checks the following rules to determine whether the number is valid:

  • Conforms to the XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.
  • No group consists entirely of zeroes.
  • Included checksums match calculated checksums

Algorithm is documented at http://de.wikipedia.org/wiki/Personalausweis

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.de.forms.DEStateSelect(attrs=None)[source]

A Select widget that uses a list of DE states as its choices.

class localflavor.de.forms.DEZipCodeField(**kwargs)[source]

A form field that validates input as a German zip code.

Valid zip codes consist of five digits.

Data

localflavor.de.de_states.STATE_CHOICES = (('BW', 'Baden-Wuerttemberg'), ('BY', 'Bavaria'), ('BE', 'Berlin'), ('BB', 'Brandenburg'), ('HB', 'Bremen'), ('HH', 'Hamburg'), ('HE', 'Hessen'), ('MV', 'Mecklenburg-Western Pomerania'), ('NI', 'Lower Saxony'), ('NW', 'North Rhine-Westphalia'), ('RP', 'Rhineland-Palatinate'), ('SL', 'Saarland'), ('SN', 'Saxony'), ('ST', 'Saxony-Anhalt'), ('SH', 'Schleswig-Holstein'), ('TH', 'Thuringia'))

An alphabetical list of states

Denmark (dk)

New in version 1.1.

Forms

Denmark specific Form helpers.

class localflavor.dk.forms.DKMunicipalitySelect(attrs=None)[source]

A Select widget that uses a list of Danish municipalities (kommuner) as its choices.

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

An Input widget that uses a list of Danish postal codes as valid input.

Data

localflavor.dk.dk_postalcodes.DK_POSTALCODES = (('0555', 'Scanning'), ('0783', 'Facility'), ('0800', 'Høje Taastrup'), ('0877', 'København C'), ('0892', 'Sjælland USF P'), ('0893', 'Sjælland USF B'), ('0894', 'Udbetaling'), ('0897', 'eBrevsprækken'), ('0899', 'Kommuneservice'), ('0900', 'København C'), ('0910', 'København C'), ('0913', 'Københavns Pakkecenter'), ('0914', 'Københavns Pakkecenter'), ('0917', 'Københavns Pakkecenter'), ('0918', 'Københavns Pakke BRC'), ('0919', 'Returprint BRC'), ('0929', 'København C'), ('0960', 'Internationalt Postcenter'), ('0999', 'København C'), ('1000', 'København K'), ('1001', 'København K'), ('1002', 'København K'), ('1003', 'København K'), ('1004', 'København K'), ('1005', 'København K'), ('1006', 'København K'), ('1007', 'København K'), ('1008', 'København K'), ('1009', 'København K'), ('1010', 'København K'), ('1011', 'København K'), ('1012', 'København K'), ('1013', 'København K'), ('1014', 'København K'), ('1015', 'København K'), ('1016', 'København K'), ('1017', 'København K'), ('1018', 'København K'), ('1019', 'København K'), ('1020', 'København K'), ('1021', 'København K'), ('1022', 'København K'), ('1023', 'København K'), ('1024', 'København K'), ('1025', 'København K'), ('1026', 'København K'), ('1045', 'København K'), ('1050', 'København K'), ('1051', 'København K'), ('1052', 'København K'), ('1053', 'København K'), ('1054', 'København K'), ('1055', 'København K'), ('1055', 'København K'), ('1056', 'København K'), ('1057', 'København K'), ('1058', 'København K'), ('1059', 'København K'), ('1060', 'København K'), ('1061', 'København K'), ('1062', 'København K'), ('1063', 'København K'), ('1064', 'København K'), ('1065', 'København K'), ('1066', 'København K'), ('1067', 'København K'), ('1068', 'København K'), ('1069', 'København K'), ('1070', 'København K'), ('1071', 'København K'), ('1072', 'København K'), ('1073', 'København K'), ('1074', 'København K'), ('1092', 'København K'), ('1093', 'København K'), ('1095', 'København K'), ('1098', 'København K'), ('1100', 'København K'), ('1101', 'København K'), ('1102', 'København K'), ('1103', 'København K'), ('1104', 'København K'), ('1105', 'København K'), ('1106', 'København K'), ('1107', 'København K'), ('1110', 'København K'), ('1111', 'København K'), ('1112', 'København K'), ('1113', 'København K'), ('1114', 'København K'), ('1115', 'København K'), ('1116', 'København K'), ('1117', 'København K'), ('1118', 'København K'), ('1119', 'København K'), ('1120', 'København K'), ('1121', 'København K'), ('1122', 'København K'), ('1123', 'København K'), ('1124', 'København K'), ('1125', 'København K'), ('1126', 'København K'), ('1127', 'København K'), ('1128', 'København K'), ('1129', 'København K'), ('1130', 'København K'), ('1131', 'København K'), ('1140', 'København K'), ('1147', 'København K'), ('1148', 'København K'), ('1150', 'København K'), ('1151', 'København K'), ('1152', 'København K'), ('1153', 'København K'), ('1154', 'København K'), ('1155', 'København K'), ('1156', 'København K'), ('1157', 'København K'), ('1158', 'København K'), ('1159', 'København K'), ('1160', 'København K'), ('1161', 'København K'), ('1162', 'København K'), ('1163', 'København K'), ('1164', 'København K'), ('1165', 'København K'), ('1165', 'København K'), ('1166', 'København K'), ('1167', 'København K'), ('1168', 'København K'), ('1169', 'København K'), ('1170', 'København K'), ('1171', 'København K'), ('1172', 'København K'), ('1173', 'København K'), ('1174', 'København K'), ('1175', 'København K'), ('1200', 'København K'), ('1201', 'København K'), ('1202', 'København K'), ('1203', 'København K'), ('1204', 'København K'), ('1205', 'København K'), ('1206', 'København K'), ('1207', 'København K'), ('1208', 'København K'), ('1209', 'København K'), ('1210', 'København K'), ('1211', 'København K'), ('1212', 'København K'), ('1213', 'København K'), ('1214', 'København K'), ('1215', 'København K'), ('1216', 'København K'), ('1217', 'København K'), ('1218', 'København K'), ('1218', 'København K'), ('1218', 'København K'), ('1218', 'København K'), ('1218', 'København K'), ('1218', 'København K'), ('1219', 'København K'), ('1220', 'København K'), ('1221', 'København K'), ('1240', 'København K'), ('1250', 'København K'), ('1251', 'København K'), ('1252', 'København K'), ('1253', 'København K'), ('1254', 'København K'), ('1255', 'København K'), ('1256', 'København K'), ('1257', 'København K'), ('1258', 'København K'), ('1259', 'København K'), ('1259', 'København K'), ('1260', 'København K'), ('1261', 'København K'), ('1263', 'København K'), ('1263', 'København K'), ('1264', 'København K'), ('1265', 'København K'), ('1266', 'København K'), ('1267', 'København K'), ('1268', 'København K'), ('1270', 'København K'), ('1271', 'København K'), ('1291', 'København K'), ('1300', 'København K'), ('1301', 'København K'), ('1302', 'København K'), ('1303', 'København K'), ('1304', 'København K'), ('1306', 'København K'), ('1307', 'København K'), ('1307', 'København K'), ('1308', 'København K'), ('1309', 'København K'), ('1310', 'København K'), ('1311', 'København K'), ('1312', 'København K'), ('1313', 'København K'), ('1314', 'København K'), ('1315', 'København K'), ('1316', 'København K'), ('1317', 'København K'), ('1318', 'København K'), ('1319', 'København K'), ('1320', 'København K'), ('1321', 'København K'), ('1322', 'København K'), ('1323', 'København K'), ('1324', 'København K'), ('1325', 'København K'), ('1326', 'København K'), ('1327', 'København K'), ('1328', 'København K'), ('1329', 'København K'), ('1349', 'København K'), ('1350', 'København K'), ('1352', 'København K'), ('1353', 'København K'), ('1354', 'København K'), ('1355', 'København K'), ('1356', 'København K'), ('1357', 'København K'), ('1358', 'København K'), ('1359', 'København K'), ('1359', 'København K'), ('1360', 'København K'), ('1361', 'København K'), ('1361', 'København K'), ('1362', 'København K'), ('1363', 'København K'), ('1364', 'København K'), ('1365', 'København K'), ('1366', 'København K'), ('1367', 'København K'), ('1368', 'København K'), ('1369', 'København K'), ('1370', 'København K'), ('1371', 'København K'), ('1400', 'København K'), ('1400', 'København K'), ('1401', 'København K'), ('1402', 'København K'), ('1402', 'København K'), ('1402', 'København K'), ('1402', 'København K'), ('1402', 'København K'), ('1403', 'København K'), ('1404', 'København K'), ('1406', 'København K'), ('1407', 'København K'), ('1408', 'København K'), ('1409', 'København K'), ('1410', 'København K'), ('1411', 'København K'), ('1411', 'København K'), ('1412', 'København K'), ('1413', 'København K'), ('1414', 'København K'), ('1415', 'København K'), ('1416', 'København K'), ('1417', 'København K'), ('1418', 'København K'), ('1419', 'København K'), ('1420', 'København K'), ('1421', 'København K'), ('1422', 'København K'), ('1423', 'København K'), ('1424', 'København K'), ('1425', 'København K'), ('1426', 'København K'), ('1427', 'København K'), ('1428', 'København K'), ('1429', 'København K'), ('1430', 'København K'), ('1431', 'København K'), ('1432', 'København K'), ('1432', 'København K'), ('1432', 'København K'), ('1433', 'København K'), ('1433', 'København K'), ('1433', 'København K'), ('1433', 'København K'), ('1433', 'København K'), ('1433', 'København K'), ('1433', 'København K'), ('1434', 'København K'), ('1435', 'København K'), ('1436', 'København K'), ('1436', 'København K'), ('1436', 'København K'), ('1436', 'København K'), ('1436', 'København K'), ('1436', 'København K'), ('1436', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1437', 'København K'), ('1438', 'København K'), ('1438', 'København K'), ('1438', 'København K'), ('1438', 'København K'), ('1438', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1439', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1440', 'København K'), ('1441', 'København K'), ('1441', 'København K'), ('1441', 'København K'), ('1448', 'København K'), ('1450', 'København K'), ('1451', 'København K'), ('1452', 'København K'), ('1453', 'København K'), ('1454', 'København K'), ('1455', 'København K'), ('1456', 'København K'), ('1457', 'København K'), ('1458', 'København K'), ('1459', 'København K'), ('1460', 'København K'), ('1461', 'København K'), ('1462', 'København K'), ('1463', 'København K'), ('1464', 'København K'), ('1465', 'København K'), ('1466', 'København K'), ('1467', 'København K'), ('1468', 'København K'), ('1470', 'København K'), ('1471', 'København K'), ('1472', 'København K'), ('1473', 'København K'), ('1500', 'København V'), ('1501', 'København V'), ('1502', 'København V'), ('1503', 'København V'), ('1504', 'København V'), ('1505', 'København V'), ('1506', 'København V'), ('1507', 'København V'), ('1508', 'København V'), ('1509', 'København V'), ('1510', 'København V'), ('1512', 'Returpost'), ('1513', 'Centraltastning'), ('1532', 'København V'), ('1533', 'København V'), ('1550', 'København V'), ('1550', 'København V'), ('1551', 'København V'), ('1552', 'København V'), ('1553', 'København V'), ('1553', 'København V'), ('1554', 'København V'), ('1555', 'København V'), ('1556', 'København V'), ('1557', 'København V'), ('1558', 'København V'), ('1559', 'København V'), ('1560', 'København V'), ('1561', 'København V'), ('1561', 'København V'), ('1562', 'København V'), ('1563', 'København V'), ('1564', 'København V'), ('1566', 'København V'), ('1567', 'København V'), ('1568', 'København V'), ('1569', 'København V'), ('1570', 'København V'), ('1570', 'København V'), ('1571', 'København V'), ('1572', 'København V'), ('1573', 'København V'), ('1574', 'København V'), ('1575', 'København V'), ('1576', 'København V'), ('1577', 'København V'), ('1577', 'København V'), ('1577', 'København V'), ('1592', 'København V'), ('1599', 'København V'), ('1600', 'København V'), ('1601', 'København V'), ('1602', 'København V'), ('1603', 'København V'), ('1604', 'København V'), ('1605', 'København V'), ('1606', 'København V'), ('1607', 'København V'), ('1608', 'København V'), ('1609', 'København V'), ('1610', 'København V'), ('1611', 'København V'), ('1612', 'København V'), ('1613', 'København V'), ('1614', 'København V'), ('1615', 'København V'), ('1616', 'København V'), ('1617', 'København V'), ('1618', 'København V'), ('1619', 'København V'), ('1620', 'København V'), ('1620', 'København V'), ('1621', 'København V'), ('1622', 'København V'), ('1623', 'København V'), ('1624', 'København V'), ('1630', 'København V'), ('1631', 'København V'), ('1632', 'København V'), ('1633', 'København V'), ('1634', 'København V'), ('1635', 'København V'), ('1640', 'København V'), ('1650', 'København V'), ('1651', 'København V'), ('1652', 'København V'), ('1653', 'København V'), ('1654', 'København V'), ('1655', 'København V'), ('1656', 'København V'), ('1657', 'København V'), ('1658', 'København V'), ('1659', 'København V'), ('1660', 'København V'), ('1660', 'København V'), ('1661', 'København V'), ('1662', 'København V'), ('1663', 'København V'), ('1664', 'København V'), ('1665', 'København V'), ('1666', 'København V'), ('1667', 'København V'), ('1668', 'København V'), ('1669', 'København V'), ('1670', 'København V'), ('1671', 'København V'), ('1671', 'København V'), ('1672', 'København V'), ('1673', 'København V'), ('1674', 'København V'), ('1675', 'København V'), ('1676', 'København V'), ('1677', 'København V'), ('1699', 'København V'), ('1700', 'København V'), ('1701', 'København V'), ('1702', 'København V'), ('1703', 'København V'), ('1704', 'København V'), ('1705', 'København V'), ('1706', 'København V'), ('1707', 'København V'), ('1708', 'København V'), ('1709', 'København V'), ('1710', 'København V'), ('1711', 'København V'), ('1711', 'København V'), ('1712', 'København V'), ('1713', 'København V'), ('1714', 'København V'), ('1715', 'København V'), ('1716', 'København V'), ('1717', 'København V'), ('1718', 'København V'), ('1719', 'København V'), ('1720', 'København V'), ('1721', 'København V'), ('1722', 'København V'), ('1723', 'København V'), ('1724', 'København V'), ('1725', 'København V'), ('1726', 'København V'), ('1727', 'København V'), ('1728', 'København V'), ('1729', 'København V'), ('1730', 'København V'), ('1731', 'København V'), ('1732', 'København V'), ('1733', 'København V'), ('1734', 'København V'), ('1735', 'København V'), ('1736', 'København V'), ('1737', 'København V'), ('1738', 'København V'), ('1739', 'København V'), ('1749', 'København V'), ('1750', 'København V'), ('1751', 'København V'), ('1752', 'København V'), ('1753', 'København V'), ('1754', 'København V'), ('1755', 'København V'), ('1756', 'København V'), ('1757', 'København V'), ('1758', 'København V'), ('1759', 'København V'), ('1760', 'København V'), ('1761', 'København V'), ('1762', 'København V'), ('1763', 'København V'), ('1764', 'København V'), ('1765', 'København V'), ('1766', 'København V'), ('1770', 'København V'), ('1771', 'København V'), ('1772', 'København V'), ('1773', 'København V'), ('1774', 'København V'), ('1775', 'København V'), ('1777', 'København V'), ('1780', 'København V'), ('1782', 'København V'), ('1785', 'København V'), ('1786', 'København V'), ('1787', 'København V'), ('1790', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1799', 'København V'), ('1800', 'Frederiksberg C'), ('1801', 'Frederiksberg C'), ('1802', 'Frederiksberg C'), ('1803', 'Frederiksberg C'), ('1804', 'Frederiksberg C'), ('1805', 'Frederiksberg C'), ('1806', 'Frederiksberg C'), ('1807', 'Frederiksberg C'), ('1808', 'Frederiksberg C'), ('1809', 'Frederiksberg C'), ('1810', 'Frederiksberg C'), ('1811', 'Frederiksberg C'), ('1812', 'Frederiksberg C'), ('1813', 'Frederiksberg C'), ('1814', 'Frederiksberg C'), ('1815', 'Frederiksberg C'), ('1816', 'Frederiksberg C'), ('1817', 'Frederiksberg C'), ('1818', 'Frederiksberg C'), ('1819', 'Frederiksberg C'), ('1820', 'Frederiksberg C'), ('1822', 'Frederiksberg C'), ('1823', 'Frederiksberg C'), ('1824', 'Frederiksberg C'), ('1825', 'Frederiksberg C'), ('1826', 'Frederiksberg C'), ('1827', 'Frederiksberg C'), ('1828', 'Frederiksberg C'), ('1829', 'Frederiksberg C'), ('1835', 'Frederiksberg C'), ('1850', 'Frederiksberg C'), ('1851', 'Frederiksberg C'), ('1852', 'Frederiksberg C'), ('1853', 'Frederiksberg C'), ('1854', 'Frederiksberg C'), ('1855', 'Frederiksberg C'), ('1856', 'Frederiksberg C'), ('1857', 'Frederiksberg C'), ('1860', 'Frederiksberg C'), ('1861', 'Frederiksberg C'), ('1862', 'Frederiksberg C'), ('1863', 'Frederiksberg C'), ('1864', 'Frederiksberg C'), ('1865', 'Frederiksberg C'), ('1866', 'Frederiksberg C'), ('1867', 'Frederiksberg C'), ('1868', 'Frederiksberg C'), ('1870', 'Frederiksberg C'), ('1871', 'Frederiksberg C'), ('1872', 'Frederiksberg C'), ('1873', 'Frederiksberg C'), ('1874', 'Frederiksberg C'), ('1875', 'Frederiksberg C'), ('1876', 'Frederiksberg C'), ('1877', 'Frederiksberg C'), ('1878', 'Frederiksberg C'), ('1879', 'Frederiksberg C'), ('1900', 'Frederiksberg C'), ('1901', 'Frederiksberg C'), ('1902', 'Frederiksberg C'), ('1903', 'Frederiksberg C'), ('1904', 'Frederiksberg C'), ('1905', 'Frederiksberg C'), ('1906', 'Frederiksberg C'), ('1908', 'Frederiksberg C'), ('1909', 'Frederiksberg C'), ('1910', 'Frederiksberg C'), ('1911', 'Frederiksberg C'), ('1912', 'Frederiksberg C'), ('1913', 'Frederiksberg C'), ('1914', 'Frederiksberg C'), ('1915', 'Frederiksberg C'), ('1916', 'Frederiksberg C'), ('1917', 'Frederiksberg C'), ('1920', 'Frederiksberg C'), ('1921', 'Frederiksberg C'), ('1922', 'Frederiksberg C'), ('1923', 'Frederiksberg C'), ('1924', 'Frederiksberg C'), ('1925', 'Frederiksberg C'), ('1926', 'Frederiksberg C'), ('1927', 'Frederiksberg C'), ('1928', 'Frederiksberg C'), ('1931', 'Frederiksberg C'), ('1950', 'Frederiksberg C'), ('1951', 'Frederiksberg C'), ('1952', 'Frederiksberg C'), ('1953', 'Frederiksberg C'), ('1954', 'Frederiksberg C'), ('1955', 'Frederiksberg C'), ('1956', 'Frederiksberg C'), ('1957', 'Frederiksberg C'), ('1958', 'Frederiksberg C'), ('1959', 'Frederiksberg C'), ('1960', 'Frederiksberg C'), ('1961', 'Frederiksberg C'), ('1962', 'Frederiksberg C'), ('1963', 'Frederiksberg C'), ('1964', 'Frederiksberg C'), ('1965', 'Frederiksberg C'), ('1966', 'Frederiksberg C'), ('1967', 'Frederiksberg C'), ('1970', 'Frederiksberg C'), ('1971', 'Frederiksberg C'), ('1972', 'Frederiksberg C'), ('1973', 'Frederiksberg C'), ('1974', 'Frederiksberg C'), ('2000', 'Frederiksberg'), ('2100', 'København Ø'), ('2150', 'Nordhavn'), ('2200', 'København N'), ('2300', 'København S'), ('2400', 'København NV'), ('2450', 'København SV'), ('2500', 'Valby'), ('2600', 'Glostrup'), ('2605', 'Brøndby'), ('2610', 'Rødovre'), ('2620', 'Albertslund'), ('2625', 'Vallensbæk'), ('2630', 'Taastrup'), ('2635', 'Ishøj'), ('2640', 'Hedehusene'), ('2650', 'Hvidovre'), ('2660', 'Brøndby Strand'), ('2665', 'Vallensbæk Strand'), ('2670', 'Greve'), ('2680', 'Solrød Strand'), ('2690', 'Karlslunde'), ('2700', 'Brønshøj'), ('2720', 'Vanløse'), ('2730', 'Herlev'), ('2740', 'Skovlunde'), ('2750', 'Ballerup'), ('2760', 'Måløv'), ('2765', 'Smørum'), ('2770', 'Kastrup'), ('2791', 'Dragør'), ('2800', 'Kongens Lyngby'), ('2820', 'Gentofte'), ('2830', 'Virum'), ('2840', 'Holte'), ('2850', 'Nærum'), ('2860', 'Søborg'), ('2870', 'Dyssegård'), ('2880', 'Bagsværd'), ('2900', 'Hellerup'), ('2920', 'Charlottenlund'), ('2930', 'Klampenborg'), ('2942', 'Skodsborg'), ('2950', 'Vedbæk'), ('2960', 'Rungsted Kyst'), ('2970', 'Hørsholm'), ('2980', 'Kokkedal'), ('2990', 'Nivå'), ('3000', 'Helsingør'), ('3050', 'Humlebæk'), ('3060', 'Espergærde'), ('3070', 'Snekkersten'), ('3080', 'Tikøb'), ('3100', 'Hornbæk'), ('3120', 'Dronningmølle'), ('3140', 'Ålsgårde'), ('3150', 'Hellebæk'), ('3200', 'Helsinge'), ('3210', 'Vejby'), ('3220', 'Tisvildeleje'), ('3230', 'Græsted'), ('3250', 'Gilleleje'), ('3300', 'Frederiksværk'), ('3310', 'Ølsted'), ('3320', 'Skævinge'), ('3330', 'Gørløse'), ('3360', 'Liseleje'), ('3370', 'Melby'), ('3390', 'Hundested'), ('3400', 'Hillerød'), ('3450', 'Allerød'), ('3460', 'Birkerød'), ('3480', 'Fredensborg'), ('3490', 'Kvistgård'), ('3500', 'Værløse'), ('3520', 'Farum'), ('3540', 'Lynge'), ('3550', 'Slangerup'), ('3600', 'Frederikssund'), ('3630', 'Jægerspris'), ('3650', 'Ølstykke'), ('3660', 'Stenløse'), ('3670', 'Veksø Sjælland'), ('3700', 'Rønne'), ('3720', 'Aakirkeby'), ('3730', 'Nexø'), ('3740', 'Svaneke'), ('3751', 'Østermarie'), ('3760', 'Gudhjem'), ('3770', 'Allinge'), ('3782', 'Klemensker'), ('3790', 'Hasle'), ('4000', 'Roskilde'), ('4030', 'Tune'), ('4040', 'Jyllinge'), ('4050', 'Skibby'), ('4060', 'Kirke Såby'), ('4070', 'Kirke Hyllinge'), ('4100', 'Ringsted'), ('4129', 'Ringsted'), ('4130', 'Viby Sjælland'), ('4140', 'Borup'), ('4160', 'Herlufmagle'), ('4171', 'Glumsø'), ('4173', 'Fjenneslev'), ('4174', 'Jystrup Midtsj'), ('4180', 'Sorø'), ('4190', 'Munke Bjergby'), ('4200', 'Slagelse'), ('4220', 'Korsør'), ('4230', 'Skælskør'), ('4241', 'Vemmelev'), ('4242', 'Boeslunde'), ('4243', 'Rude'), ('4244', 'Agersø'), ('4245', 'Omø'), ('4250', 'Fuglebjerg'), ('4261', 'Dalmose'), ('4262', 'Sandved'), ('4270', 'Høng'), ('4281', 'Gørlev'), ('4291', 'Ruds Vedby'), ('4293', 'Dianalund'), ('4295', 'Stenlille'), ('4296', 'Nyrup'), ('4300', 'Holbæk'), ('4305', 'Orø'), ('4320', 'Lejre'), ('4330', 'Hvalsø'), ('4340', 'Tølløse'), ('4350', 'Ugerløse'), ('4360', 'Kirke Eskilstrup'), ('4370', 'Store Merløse'), ('4390', 'Vipperød'), ('4400', 'Kalundborg'), ('4420', 'Regstrup'), ('4440', 'Mørkøv'), ('4450', 'Jyderup'), ('4460', 'Snertinge'), ('4470', 'Svebølle'), ('4480', 'Store Fuglede'), ('4490', 'Jerslev Sjælland'), ('4500', 'Nykøbing Sj'), ('4520', 'Svinninge'), ('4532', 'Gislinge'), ('4534', 'Hørve'), ('4540', 'Fårevejle'), ('4550', 'Asnæs'), ('4560', 'Vig'), ('4571', 'Grevinge'), ('4572', 'Nørre Asmindrup'), ('4573', 'Højby'), ('4581', 'Rørvig'), ('4583', 'Sjællands Odde'), ('4591', 'Føllenslev'), ('4592', 'Sejerø'), ('4593', 'Eskebjerg'), ('4600', 'Køge'), ('4621', 'Gadstrup'), ('4622', 'Havdrup'), ('4623', 'Lille Skensved'), ('4632', 'Bjæverskov'), ('4640', 'Faxe'), ('4652', 'Hårlev'), ('4653', 'Karise'), ('4654', 'Faxe Ladeplads'), ('4660', 'Store Heddinge'), ('4671', 'Strøby'), ('4672', 'Klippinge'), ('4673', 'Rødvig Stevns'), ('4681', 'Herfølge'), ('4682', 'Tureby'), ('4683', 'Rønnede'), ('4684', 'Holmegaard'), ('4690', 'Haslev'), ('4700', 'Næstved'), ('4720', 'Præstø'), ('4733', 'Tappernøje'), ('4735', 'Mern'), ('4736', 'Karrebæksminde'), ('4750', 'Lundby'), ('4760', 'Vordingborg'), ('4771', 'Kalvehave'), ('4772', 'Langebæk'), ('4773', 'Stensved'), ('4780', 'Stege'), ('4791', 'Borre'), ('4792', 'Askeby'), ('4793', 'Bogø By'), ('4800', 'Nykøbing F'), ('4840', 'Nørre Alslev'), ('4850', 'Stubbekøbing'), ('4862', 'Guldborg'), ('4863', 'Eskilstrup'), ('4871', 'Horbelev'), ('4872', 'Idestrup'), ('4873', 'Væggerløse'), ('4874', 'Gedser'), ('4880', 'Nysted'), ('4891', 'Toreby L'), ('4892', 'Kettinge'), ('4894', 'Øster Ulslev'), ('4895', 'Errindlev'), ('4900', 'Nakskov'), ('4912', 'Harpelunde'), ('4913', 'Horslunde'), ('4920', 'Søllested'), ('4930', 'Maribo'), ('4941', 'Bandholm'), ('4942', 'Askø og Lilleø'), ('4943', 'Torrig L'), ('4944', 'Fejø'), ('4945', 'Femø'), ('4951', 'Nørreballe'), ('4952', 'Stokkemarke'), ('4953', 'Vesterborg'), ('4960', 'Holeby'), ('4970', 'Rødby'), ('4983', 'Dannemare'), ('4990', 'Sakskøbing'), ('4992', 'Midtsjælland USF P'), ('5000', 'Odense C'), ('5029', 'Odense C'), ('5100', 'Odense C'), ('5200', 'Odense V'), ('5210', 'Odense NV'), ('5220', 'Odense SØ'), ('5230', 'Odense M'), ('5240', 'Odense NØ'), ('5250', 'Odense SV'), ('5260', 'Odense S'), ('5270', 'Odense N'), ('5290', 'Marslev'), ('5300', 'Kerteminde'), ('5320', 'Agedrup'), ('5330', 'Munkebo'), ('5350', 'Rynkeby'), ('5370', 'Mesinge'), ('5380', 'Dalby'), ('5390', 'Martofte'), ('5400', 'Bogense'), ('5450', 'Otterup'), ('5462', 'Morud'), ('5463', 'Harndrup'), ('5464', 'Brenderup Fyn'), ('5466', 'Asperup'), ('5471', 'Søndersø'), ('5474', 'Veflinge'), ('5485', 'Skamby'), ('5491', 'Blommenslyst'), ('5492', 'Vissenbjerg'), ('5500', 'Middelfart'), ('5540', 'Ullerslev'), ('5550', 'Langeskov'), ('5560', 'Aarup'), ('5580', 'Nørre Aaby'), ('5591', 'Gelsted'), ('5592', 'Ejby'), ('5600', 'Faaborg'), ('5601', 'Lyø'), ('5602', 'Avernakø'), ('5603', 'Bjørnø'), ('5610', 'Assens'), ('5620', 'Glamsbjerg'), ('5631', 'Ebberup'), ('5642', 'Millinge'), ('5672', 'Broby'), ('5683', 'Haarby'), ('5690', 'Tommerup'), ('5700', 'Svendborg'), ('5750', 'Ringe'), ('5762', 'Vester Skerninge'), ('5771', 'Stenstrup'), ('5772', 'Kværndrup'), ('5792', 'Årslev'), ('5800', 'Nyborg'), ('5853', 'Ørbæk'), ('5854', 'Gislev'), ('5856', 'Ryslinge'), ('5863', 'Ferritslev Fyn'), ('5871', 'Frørup'), ('5874', 'Hesselager'), ('5881', 'Skårup Fyn'), ('5882', 'Vejstrup'), ('5883', 'Oure'), ('5884', 'Gudme'), ('5892', 'Gudbjerg Sydfyn'), ('5900', 'Rudkøbing'), ('5932', 'Humble'), ('5935', 'Bagenkop'), ('5943', 'Strynø'), ('5953', 'Tranekær'), ('5960', 'Marstal'), ('5965', 'Birkholm'), ('5970', 'Ærøskøbing'), ('5985', 'Søby Ærø'), ('6000', 'Kolding'), ('6040', 'Egtved'), ('6051', 'Almind'), ('6052', 'Viuf'), ('6064', 'Jordrup'), ('6070', 'Christiansfeld'), ('6091', 'Bjert'), ('6092', 'Sønder Stenderup'), ('6093', 'Sjølund'), ('6094', 'Hejls'), ('6100', 'Haderslev'), ('6200', 'Aabenraa'), ('6210', 'Barsø'), ('6230', 'Rødekro'), ('6240', 'Løgumkloster'), ('6261', 'Bredebro'), ('6270', 'Tønder'), ('6280', 'Højer'), ('6300', 'Gråsten'), ('6310', 'Broager'), ('6320', 'Egernsund'), ('6330', 'Padborg'), ('6340', 'Kruså'), ('6360', 'Tinglev'), ('6372', 'Bylderup-Bov'), ('6392', 'Bolderslev'), ('6400', 'Sønderborg'), ('6430', 'Nordborg'), ('6440', 'Augustenborg'), ('6470', 'Sydals'), ('6500', 'Vojens'), ('6510', 'Gram'), ('6520', 'Toftlund'), ('6534', 'Agerskov'), ('6535', 'Branderup J'), ('6541', 'Bevtoft'), ('6560', 'Sommersted'), ('6580', 'Vamdrup'), ('6600', 'Vejen'), ('6621', 'Gesten'), ('6622', 'Bække'), ('6623', 'Vorbasse'), ('6630', 'Rødding'), ('6640', 'Lunderskov'), ('6650', 'Brørup'), ('6660', 'Lintrup'), ('6670', 'Holsted'), ('6682', 'Hovborg'), ('6683', 'Føvling'), ('6690', 'Gørding'), ('6700', 'Esbjerg'), ('6701', 'Esbjerg'), ('6705', 'Esbjerg Ø'), ('6710', 'Esbjerg V'), ('6715', 'Esbjerg N'), ('6720', 'Fanø'), ('6731', 'Tjæreborg'), ('6740', 'Bramming'), ('6752', 'Glejbjerg'), ('6753', 'Agerbæk'), ('6760', 'Ribe'), ('6771', 'Gredstedbro'), ('6780', 'Skærbæk'), ('6792', 'Rømø'), ('6800', 'Varde'), ('6818', 'Årre'), ('6823', 'Ansager'), ('6830', 'Nørre Nebel'), ('6840', 'Oksbøl'), ('6851', 'Janderup Vestj'), ('6852', 'Billum'), ('6853', 'Vejers Strand'), ('6854', 'Henne'), ('6855', 'Outrup'), ('6857', 'Blåvand'), ('6862', 'Tistrup'), ('6870', 'Ølgod'), ('6880', 'Tarm'), ('6893', 'Hemmet'), ('6900', 'Skjern'), ('6920', 'Videbæk'), ('6933', 'Kibæk'), ('6940', 'Lem St'), ('6950', 'Ringkøbing'), ('6960', 'Hvide Sande'), ('6971', 'Spjald'), ('6973', 'Ørnhøj'), ('6980', 'Tim'), ('6990', 'Ulfborg'), ('7000', 'Fredericia'), ('7007', 'Fredericia'), ('7017', 'Taulov Pakkecenter'), ('7018', 'Pakker TLP'), ('7029', 'Fredericia'), ('7080', 'Børkop'), ('7100', 'Vejle'), ('7120', 'Vejle Øst'), ('7130', 'Juelsminde'), ('7140', 'Stouby'), ('7150', 'Barrit'), ('7160', 'Tørring'), ('7171', 'Uldum'), ('7173', 'Vonge'), ('7182', 'Bredsten'), ('7183', 'Randbøl'), ('7184', 'Vandel'), ('7190', 'Billund'), ('7200', 'Grindsted'), ('7250', 'Hejnsvig'), ('7260', 'Sønder Omme'), ('7270', 'Stakroge'), ('7280', 'Sønder Felding'), ('7300', 'Jelling'), ('7321', 'Gadbjerg'), ('7323', 'Give'), ('7330', 'Brande'), ('7361', 'Ejstrupholm'), ('7362', 'Hampen'), ('7400', 'Herning'), ('7429', 'Herning'), ('7430', 'Ikast'), ('7441', 'Bording'), ('7442', 'Engesvang'), ('7451', 'Sunds'), ('7470', 'Karup J'), ('7480', 'Vildbjerg'), ('7490', 'Aulum'), ('7500', 'Holstebro'), ('7540', 'Haderup'), ('7550', 'Sørvad'), ('7560', 'Hjerm'), ('7570', 'Vemb'), ('7600', 'Struer'), ('7620', 'Lemvig'), ('7650', 'Bøvlingbjerg'), ('7660', 'Bækmarksbro'), ('7673', 'Harboøre'), ('7680', 'Thyborøn'), ('7700', 'Thisted'), ('7730', 'Hanstholm'), ('7741', 'Frøstrup'), ('7742', 'Vesløs'), ('7752', 'Snedsted'), ('7755', 'Bedsted Thy'), ('7760', 'Hurup Thy'), ('7770', 'Vestervig'), ('7790', 'Thyholm'), ('7800', 'Skive'), ('7830', 'Vinderup'), ('7840', 'Højslev'), ('7850', 'Stoholm Jyll'), ('7860', 'Spøttrup'), ('7870', 'Roslev'), ('7884', 'Fur'), ('7900', 'Nykøbing M'), ('7950', 'Erslev'), ('7960', 'Karby'), ('7970', 'Redsted M'), ('7980', 'Vils'), ('7990', 'Øster Assels'), ('7992', 'Sydjylland/Fyn USF P'), ('7993', 'Sydjylland/Fyn USF B'), ('7996', 'Fakturaservice'), ('7997', 'Fakturascanning'), ('7998', 'Statsservice'), ('7999', 'Kommunepost'), ('8000', 'Aarhus C'), ('8100', 'Aarhus C'), ('8200', 'Aarhus N'), ('8210', 'Aarhus V'), ('8220', 'Brabrand'), ('8229', 'Risskov Ø'), ('8230', 'Åbyhøj'), ('8240', 'Risskov'), ('8245', 'Risskov Ø'), ('8250', 'Egå'), ('8260', 'Viby J'), ('8270', 'Højbjerg'), ('8300', 'Odder'), ('8305', 'Samsø'), ('8310', 'Tranbjerg J'), ('8320', 'Mårslet'), ('8330', 'Beder'), ('8340', 'Malling'), ('8350', 'Hundslund'), ('8355', 'Solbjerg'), ('8361', 'Hasselager'), ('8362', 'Hørning'), ('8370', 'Hadsten'), ('8380', 'Trige'), ('8381', 'Tilst'), ('8382', 'Hinnerup'), ('8400', 'Ebeltoft'), ('8410', 'Rønde'), ('8420', 'Knebel'), ('8444', 'Balle'), ('8450', 'Hammel'), ('8462', 'Harlev J'), ('8464', 'Galten'), ('8471', 'Sabro'), ('8472', 'Sporup'), ('8500', 'Grenaa'), ('8520', 'Lystrup'), ('8530', 'Hjortshøj'), ('8541', 'Skødstrup'), ('8543', 'Hornslet'), ('8544', 'Mørke'), ('8550', 'Ryomgård'), ('8560', 'Kolind'), ('8570', 'Trustrup'), ('8581', 'Nimtofte'), ('8585', 'Glesborg'), ('8586', 'Ørum Djurs'), ('8592', 'Anholt'), ('8600', 'Silkeborg'), ('8620', 'Kjellerup'), ('8632', 'Lemming'), ('8641', 'Sorring'), ('8643', 'Ans By'), ('8653', 'Them'), ('8654', 'Bryrup'), ('8660', 'Skanderborg'), ('8670', 'Låsby'), ('8680', 'Ry'), ('8700', 'Horsens'), ('8721', 'Daugård'), ('8722', 'Hedensted'), ('8723', 'Løsning'), ('8732', 'Hovedgård'), ('8740', 'Brædstrup'), ('8751', 'Gedved'), ('8752', 'Østbirk'), ('8762', 'Flemming'), ('8763', 'Rask Mølle'), ('8765', 'Klovborg'), ('8766', 'Nørre Snede'), ('8781', 'Stenderup'), ('8783', 'Hornsyld'), ('8789', 'Endelave'), ('8799', 'Tunø'), ('8800', 'Viborg'), ('8830', 'Tjele'), ('8831', 'Løgstrup'), ('8832', 'Skals'), ('8840', 'Rødkærsbro'), ('8850', 'Bjerringbro'), ('8860', 'Ulstrup'), ('8870', 'Langå'), ('8881', 'Thorsø'), ('8882', 'Fårvang'), ('8883', 'Gjern'), ('8900', 'Randers C'), ('8920', 'Randers NV'), ('8930', 'Randers NØ'), ('8940', 'Randers SV'), ('8950', 'Ørsted'), ('8960', 'Randers SØ'), ('8961', 'Allingåbro'), ('8963', 'Auning'), ('8970', 'Havndal'), ('8981', 'Spentrup'), ('8983', 'Gjerlev J'), ('8990', 'Fårup'), ('9000', 'Aalborg'), ('9029', 'Aalborg'), ('9100', 'Aalborg'), ('9200', 'Aalborg SV'), ('9210', 'Aalborg SØ'), ('9220', 'Aalborg Øst'), ('9230', 'Svenstrup J'), ('9240', 'Nibe'), ('9260', 'Gistrup'), ('9270', 'Klarup'), ('9280', 'Storvorde'), ('9293', 'Kongerslev'), ('9300', 'Sæby'), ('9310', 'Vodskov'), ('9320', 'Hjallerup'), ('9330', 'Dronninglund'), ('9340', 'Asaa'), ('9352', 'Dybvad'), ('9362', 'Gandrup'), ('9370', 'Hals'), ('9380', 'Vestbjerg'), ('9381', 'Sulsted'), ('9382', 'Tylstrup'), ('9400', 'Nørresundby'), ('9430', 'Vadum'), ('9440', 'Aabybro'), ('9460', 'Brovst'), ('9480', 'Løkken'), ('9490', 'Pandrup'), ('9492', 'Blokhus'), ('9493', 'Saltum'), ('9500', 'Hobro'), ('9510', 'Arden'), ('9520', 'Skørping'), ('9530', 'Støvring'), ('9541', 'Suldrup'), ('9550', 'Mariager'), ('9560', 'Hadsund'), ('9574', 'Bælum'), ('9575', 'Terndrup'), ('9600', 'Aars'), ('9610', 'Nørager'), ('9620', 'Aalestrup'), ('9631', 'Gedsted'), ('9632', 'Møldrup'), ('9640', 'Farsø'), ('9670', 'Løgstør'), ('9681', 'Ranum'), ('9690', 'Fjerritslev'), ('9700', 'Brønderslev'), ('9740', 'Jerslev J'), ('9750', 'Østervrå'), ('9760', 'Vrå'), ('9800', 'Hjørring'), ('9830', 'Tårs'), ('9850', 'Hirtshals'), ('9870', 'Sindal'), ('9881', 'Bindslev'), ('9900', 'Frederikshavn'), ('9940', 'Læsø'), ('9970', 'Strandby'), ('9981', 'Jerup'), ('9982', 'Ålbæk'), ('9990', 'Skagen'), ('9992', 'Jylland USF P'), ('9993', 'Jylland USF B'), ('9996', 'Fakturaservice'), ('9997', 'Fakturascanning'), ('9998', 'Borgerservice'), ('2412', 'Santa Claus/Julemanden'), ('3900', 'Nuuk'), ('3905', 'Nuussuaq'), ('3910', 'Kangerlussuaq'), ('3911', 'Sisimiut'), ('3912', 'Maniitsoq'), ('3913', 'Tasiilaq'), ('3915', 'Kulusuk'), ('3919', 'Alluitsup Paa'), ('3920', 'Qaqortoq'), ('3921', 'Narsaq'), ('3922', 'Nanortalik'), ('3923', 'Narsarsuaq'), ('3924', 'Ikerasassuaq'), ('3930', 'Kangilinnguit'), ('3932', 'Arsuk'), ('3940', 'Paamiut'), ('3950', 'Aasiaat'), ('3951', 'Qasigiannguit'), ('3952', 'Ilulissat'), ('3953', 'Qeqertarsuaq'), ('3955', 'Kangaatsiaq'), ('3961', 'Uummannaq'), ('3962', 'Upernavik'), ('3964', 'Qaarsut'), ('3970', 'Pituffik'), ('3971', 'Qaanaaq'), ('3972', 'Station Nord'), ('3980', 'Ittoqqortoormiit'), ('3982', 'Mestersvig'), ('3984', 'Danmarkshavn'), ('3985', 'Constable Pynt'), ('3992', 'Slædepatrulje Sirius'), ('100', 'Tórshavn'), ('110', 'Tórshavn'), ('160', 'Argir'), ('165', 'Argir'), ('175', 'Kirkjubøur'), ('176', 'Velbastadur'), ('177', '"Sydradalur, Streymoy"'), ('178', 'Nordradalur'), ('180', 'Kaldbak'), ('185', 'Kaldbaksbotnur'), ('186', 'Sund'), ('187', 'Hvitanes'), ('188', 'Hoyvík'), ('210', 'Sandur'), ('215', 'Sandur'), ('220', 'Skálavík'), ('230', 'Húsavík'), ('235', 'Dalur'), ('236', 'Skarvanes'), ('240', 'Skopun'), ('260', 'Skúvoy'), ('270', 'Nólsoy'), ('280', 'Hestur'), ('285', 'Koltur'), ('286', 'Stóra Dimun'), ('330', 'Stykkid'), ('335', 'Leynar'), ('336', 'Skællingur'), ('340', 'Kvívík'), ('350', 'Vestmanna'), ('355', 'Vestmanna'), ('358', 'Válur'), ('360', 'Sandavágur'), ('370', 'Midvágur'), ('375', 'Midvágur'), ('380', 'Sørvágur'), ('385', 'Vatnsoyrar'), ('386', 'Bøur'), ('387', 'Gásadalur'), ('388', 'Mykines'), ('400', 'Oyrarbakki'), ('405', 'Oyrarbakki'), ('410', 'Kollafjørdur'), ('415', 'Oyrareingir'), ('416', 'Signabøur'), ('420', 'Hósvík'), ('430', 'Hvalvík'), ('435', 'Streymnes'), ('436', 'Saksun'), ('437', 'Nesvík'), ('438', 'Langasandur'), ('440', 'Haldarsvík'), ('445', 'Tjørnuvík'), ('450', 'Oyri'), ('460', 'Nordskáli'), ('465', 'Svináir'), ('466', 'Ljósá'), ('470', 'Eidi'), ('475', 'Funningur'), ('476', 'Gjógv'), ('477', 'Funningsfjørdur'), ('478', 'Elduvík'), ('480', 'Skáli'), ('485', 'Skálafjørdur'), ('490', 'Strendur'), ('494', 'Innan Glyvur'), ('495', 'Kolbanargjógv'), ('496', 'Morskranes'), ('497', 'Selatrad'), ('510', 'Gøta'), ('511', 'Gøtugjógv'), ('512', 'Nordragøta'), ('513', 'Sydrugøta'), ('515', 'Gøta'), ('520', 'Leirvík'), ('530', 'Fuglafjørdur'), ('535', 'Fuglafjørdur'), ('600', 'Saltangará'), ('610', 'Saltangará'), ('620', 'Runavík'), ('625', 'Glyvrar'), ('626', 'Lambareidi'), ('627', 'Lambi'), ('640', 'Rituvík'), ('645', 'Æduvík'), ('650', 'Toftir'), ('655', '"Nes, Eysturoy"'), ('656', 'Saltnes'), ('660', 'Søldarfjørdur'), ('665', 'Skipanes'), ('666', 'Gøtueidi'), ('690', 'Oyndarfjørdur'), ('695', 'Hellur'), ('700', 'Klaksvík'), ('710', 'Klaksvík'), ('725', 'Nordoyri'), ('726', 'Ánir'), ('727', 'Árnafjørdur'), ('730', 'Norddepil'), ('735', 'Depil'), ('736', 'Nordtoftir'), ('737', 'Múli'), ('740', 'Hvannasund'), ('750', 'Vidareidi'), ('765', 'Svinoy'), ('766', 'Kirkja'), ('767', 'Hattarvík'), ('780', 'Kunoy'), ('785', 'Haraldssund'), ('795', '"Sydradalur, Kalsoy"'), ('796', 'Húsar'), ('797', 'Mikladalur'), ('798', 'Trøllanes'), ('800', 'Tvøroyri'), ('810', 'Tvøroyri'), ('825', 'Frodba'), ('826', 'Trongisvágur'), ('827', 'Øravík'), ('850', 'Hvalba'), ('860', 'Sandvík'), ('870', 'Fámjin'), ('900', 'Vágur'), ('910', 'Vágur'), ('925', '"Nes, Vágur"'), ('926', 'Lopra'), ('927', 'Akrar'), ('928', 'Vikarbyrgi'), ('950', 'Porkeri'), ('960', 'Hov'), ('970', 'Sumba'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

localflavor.dk.dk_municipalities.REGION_HOVEDSTADEN = [('albertslund', 'Albertslund'), ('alleroed', 'Allerød'), ('ballerup', 'Ballerup'), ('bornholm', 'Bornholm'), ('broendby', 'Brøndby'), ('dragoer', 'Dragør'), ('egedal', 'Egedal'), ('fredensborg', 'Fredensborg'), ('frederiksberg', 'Frederiksberg'), ('frederikssund', 'Frederikssund'), ('furesoe', 'Furesø'), ('gentofte', 'Gentofte'), ('gladsaxe', 'Gladsaxe'), ('glostrup', 'Glostrup'), ('gribskov', 'Gribskov'), ('halsnaes', 'Halsnæs'), ('helsingoer', 'Helsingør'), ('herlev', 'Herlev'), ('hilleroed', 'Hillerød'), ('hvidovre', 'Hvidovre'), ('hoeje-taastrup', 'Høje-Taastrup'), ('hoersholm', 'Hørsholm'), ('ishoej', 'Ishøj'), ('koebenhavn', 'København'), ('lyngby-taarbaek', 'Lyngby-Taarbæk'), ('rudersdal', 'Rudersdal'), ('roedovre', 'Rødovre'), ('taarnby', 'Tårnby'), ('vallensbaek', 'Vallensbæk')]

A list of municipalities in the Danish region Hovedstaden as choices in a formfield.

localflavor.dk.dk_municipalities.REGION_MIDTJYLLAND = [('favrskov', 'Favrskov'), ('hedensted', 'Hedensted'), ('herning', 'Herning'), ('holstebro', 'Holstebro'), ('horsens', 'Horsens'), ('ikast-Brande', 'Ikast-Brande'), ('lemvig', 'Lemvig'), ('norddjurs', 'Norddjurs'), ('odder', 'Odder'), ('randers', 'Randers'), ('ringkoebing-skjern', 'Ringkøbing-Skjern'), ('samsoe', 'Samsø'), ('silkeborg', 'Silkeborg'), ('skanderborg', 'Skanderborg'), ('skive', 'Skive'), ('struer', 'Struer'), ('syddjurs', 'Syddjurs'), ('viborg', 'Viborg'), ('aarhus', 'Aarhus')]

A list of municipalities in the Danish region Midtjylland as choices in a formfield.

localflavor.dk.dk_municipalities.REGION_NORDJYLLAND = [('broenderslev', 'Brønderslev'), ('frederikshavn', 'Frederikshavn'), ('hjoerring', 'Hjørring'), ('jammerbugt', 'Jammerbugt'), ('laesoe', 'Læsø'), ('mariagerfjord', 'Mariagerfjord'), ('morsoe', 'Morsø'), ('rebild', 'Rebild'), ('thisted', 'Thisted'), ('vesthimmerland', 'Vesthimmerland'), ('aalborg', 'Aalborg')]

A list of municipalities in the Danish region Nordjylland as choices in a formfield.

localflavor.dk.dk_municipalities.REGION_SJAELLAND = [('faxe', 'Faxe'), ('greve', 'Greve'), ('guldborgsund', 'Guldborgsund'), ('holbaek', 'Holbæk'), ('kalundborg', 'Kalundborg'), ('koege', 'Køge'), ('lejre', 'Lejre'), ('lolland', 'Lolland'), ('naestved', 'Næstved'), ('odsherred', 'Odsherred'), ('ringsted', 'Ringsted'), ('roskilde', 'Roskilde'), ('slagelse', 'Slagelse'), ('solroed', 'Solrød'), ('soroe', 'Sorø'), ('stevns', 'Stevns'), ('vordingborg', 'Vordingborg')]

A list of municipalities in the Danish region Sjælland as choices in a formfield.

localflavor.dk.dk_municipalities.REGION_SYDDANMARK = [('assens', 'Assens'), ('billund', 'Billund'), ('esbjerg', 'Esbjerg'), ('fanoe', 'Fanø'), ('fredericia', 'Fredericia'), ('faaborg-Midtfyn', 'Faaborg-Midtfyn'), ('haderslev', 'Haderslev'), ('kerteminde', 'Kerteminde'), ('kolding', 'Kolding'), ('langeland', 'Langeland'), ('middelfart', 'Middelfart'), ('nordfyn', 'Nordfyn'), ('nyborg', 'Nyborg'), ('odense', 'Odense'), ('svendborg', 'Svendborg'), ('soenderborg', 'Sønderborg'), ('toender', 'Tønder'), ('varde', 'Varde'), ('vejen', 'Vejen'), ('vejle', 'Vejle'), ('aeroe', 'Ærø'), ('aabenraa', 'Aabenraa')]

A list of municipalities in the Danish region Syddanmark as choices in a formfield.

localflavor.dk.dk_municipalities.DK_MUNICIPALITIES = [('Region Hovedstaden', [('albertslund', 'Albertslund'), ('alleroed', 'Allerød'), ('ballerup', 'Ballerup'), ('bornholm', 'Bornholm'), ('broendby', 'Brøndby'), ('dragoer', 'Dragør'), ('egedal', 'Egedal'), ('fredensborg', 'Fredensborg'), ('frederiksberg', 'Frederiksberg'), ('frederikssund', 'Frederikssund'), ('furesoe', 'Furesø'), ('gentofte', 'Gentofte'), ('gladsaxe', 'Gladsaxe'), ('glostrup', 'Glostrup'), ('gribskov', 'Gribskov'), ('halsnaes', 'Halsnæs'), ('helsingoer', 'Helsingør'), ('herlev', 'Herlev'), ('hilleroed', 'Hillerød'), ('hvidovre', 'Hvidovre'), ('hoeje-taastrup', 'Høje-Taastrup'), ('hoersholm', 'Hørsholm'), ('ishoej', 'Ishøj'), ('koebenhavn', 'København'), ('lyngby-taarbaek', 'Lyngby-Taarbæk'), ('rudersdal', 'Rudersdal'), ('roedovre', 'Rødovre'), ('taarnby', 'Tårnby'), ('vallensbaek', 'Vallensbæk')]), ('Region Midtjylland', [('favrskov', 'Favrskov'), ('hedensted', 'Hedensted'), ('herning', 'Herning'), ('holstebro', 'Holstebro'), ('horsens', 'Horsens'), ('ikast-Brande', 'Ikast-Brande'), ('lemvig', 'Lemvig'), ('norddjurs', 'Norddjurs'), ('odder', 'Odder'), ('randers', 'Randers'), ('ringkoebing-skjern', 'Ringkøbing-Skjern'), ('samsoe', 'Samsø'), ('silkeborg', 'Silkeborg'), ('skanderborg', 'Skanderborg'), ('skive', 'Skive'), ('struer', 'Struer'), ('syddjurs', 'Syddjurs'), ('viborg', 'Viborg'), ('aarhus', 'Aarhus')]), ('Region Nordjylland', [('broenderslev', 'Brønderslev'), ('frederikshavn', 'Frederikshavn'), ('hjoerring', 'Hjørring'), ('jammerbugt', 'Jammerbugt'), ('laesoe', 'Læsø'), ('mariagerfjord', 'Mariagerfjord'), ('morsoe', 'Morsø'), ('rebild', 'Rebild'), ('thisted', 'Thisted'), ('vesthimmerland', 'Vesthimmerland'), ('aalborg', 'Aalborg')]), ('Region Sjælland', [('faxe', 'Faxe'), ('greve', 'Greve'), ('guldborgsund', 'Guldborgsund'), ('holbaek', 'Holbæk'), ('kalundborg', 'Kalundborg'), ('koege', 'Køge'), ('lejre', 'Lejre'), ('lolland', 'Lolland'), ('naestved', 'Næstved'), ('odsherred', 'Odsherred'), ('ringsted', 'Ringsted'), ('roskilde', 'Roskilde'), ('slagelse', 'Slagelse'), ('solroed', 'Solrød'), ('soroe', 'Sorø'), ('stevns', 'Stevns'), ('vordingborg', 'Vordingborg')]), ('Region Syddanmark', [('assens', 'Assens'), ('billund', 'Billund'), ('esbjerg', 'Esbjerg'), ('fanoe', 'Fanø'), ('fredericia', 'Fredericia'), ('faaborg-Midtfyn', 'Faaborg-Midtfyn'), ('haderslev', 'Haderslev'), ('kerteminde', 'Kerteminde'), ('kolding', 'Kolding'), ('langeland', 'Langeland'), ('middelfart', 'Middelfart'), ('nordfyn', 'Nordfyn'), ('nyborg', 'Nyborg'), ('odense', 'Odense'), ('svendborg', 'Svendborg'), ('soenderborg', 'Sønderborg'), ('toender', 'Tønder'), ('varde', 'Varde'), ('vejen', 'Vejen'), ('vejle', 'Vejle'), ('aeroe', 'Ærø'), ('aabenraa', 'Aabenraa')])]

A list of Danish municipalities grouped by region.

Ecuador (ec)

Forms

Ecuador-specific form helpers.

class localflavor.ec.forms.ECProvinceSelect(attrs=None)[source]

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

Data

localflavor.ec.ec_provinces.PROVINCE_CHOICES = (('A', 'Azuay'), ('B', 'Bolívar'), ('F', 'Cañar'), ('C', 'Carchi'), ('H', 'Chimborazo'), ('X', 'Cotopaxi'), ('O', 'El Oro'), ('E', 'Esmeraldas'), ('W', 'Galápagos'), ('G', 'Guayas'), ('I', 'Imbabura'), ('L', 'Loja'), ('R', 'Los Ríos'), ('M', 'Manabí'), ('S', 'Morona Santiago'), ('N', 'Napo'), ('D', 'Orellana'), ('Y', 'Pastaza'), ('P', 'Pichincha'), ('SE', 'Santa Elena'), ('SD', 'Santo Domingo de los Tsáchilas'), ('U', 'Sucumbíos'), ('T', 'Tungurahua'), ('Z', 'Zamora Chinchipe'))

A list of Ecuador provinces as choices in a formfield.

Estonia (ee)

New in version 1.1.

Forms

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

A form field that validates input as an Estonian business registration code.

New in version 1.2.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.ee.forms.EECountySelect(attrs=None)[source]

A Select widget that uses a list of Estonian counties as its choices.

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

A form field that validates input as an Estonian personal identification code.

See: https://www.riigiteataja.ee/akt/106032012004

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

static ee_checksum(value)[source]

Takes a string of digits as input, returns check digit.

class localflavor.ee.forms.EEZipCodeField(**kwargs)[source]

A form field that validates input as a Estonian zip code.

Valid codes consist of five digits; first digit cannot be 0.

Data

localflavor.ee.ee_counties.COUNTY_CHOICES = (('37', 'Harju County'), ('39', 'Hiiu County'), ('44', 'Ida-Viru County'), ('49', 'Jõgeva County'), ('51', 'Järva County'), ('57', 'Lääne County'), ('59', 'Lääne-Viru County'), ('65', 'Põlva County'), ('67', 'Pärnu County'), ('70', 'Rapla County'), ('74', 'Saare County'), ('78', 'Tartu County'), ('82', 'Valga County'), ('84', 'Viljandi County'), ('86', 'Võru County'))

A list of Estonian counties as choices in a formfield. Identifiers based on ISO 3166-2:EE. https://en.wikipedia.org/wiki/ISO_3166-2:EE

Egypt (eg)

Forms

Egypt-specific Form helpers.

class localflavor.eg.forms.EGGovernorateSelect(attrs=None)[source]

A Select widget that uses a list of Egypt governorates as its choices.

New in version 3.0.

class localflavor.eg.forms.EGNationalIDNumberField(max_length=14, min_length=14, **kwargs)[source]

Egypt ID numbers are 14 digits, second to seventh digits represents the person’s birthdate.

Checks the following rules to determine the validity of the number:
  • The number consist of 14 digits.
  • The century number is valid.
  • The birthdate of the person is a valid date.
  • The governorate code is valid.

New in version 3.0.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Spain (es)

Forms

Spanish-specific Form helpers.

class localflavor.es.forms.ESCCCField(**kwargs)[source]

A form field that validates its input as a Spanish bank account or CCC (Codigo Cuenta Cliente).

Spanish CCC is in format EEEE-OOOO-CC-AAAAAAAAAA where:

E = entity O = office C = checksum A = account

It’s also valid to use a space as delimiter, or to use no delimiter.

First checksum digit validates entity and office, and last one validates account. Validation is done multiplying every digit of 10 digit value (with leading 0 if necessary) by number in its position in string 1, 2, 4, 8, 5, 10, 9, 7, 3, 6. Sum resulting numbers and extract it from 11. Result is checksum except when 10 then is 1, or when 11 then is 0.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.es.forms.ESIdentityCardNumberField(only_nif=False, **kwargs)[source]

Spanish NIF/NIE/CIF (Fiscal Identification Number) code.

Validates three different formats:

NIF (individuals): 12345678A CIF (companies): A12345678 NIE (foreigners): X12345678A

according to a couple of simple checksum algorithms.

Value can include a space or hyphen separator between number and letters. Number length is not checked for NIF (or NIE), old values start with a 1, and future values can contain digits greater than 8. The CIF control digit can be a number or a letter depending on company type. Algorithm is not public, and different authors have different opinions on which ones allows letters, so both validations are assumed true for all types.

http://es.wikipedia.org/wiki/N%C3%BAmero_de_identificaci%C3%B3n_fiscal

Changed in version 1.1.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.es.forms.ESPostalCodeField(**kwargs)[source]

A form field that validates its input as a spanish postal code.

Spanish postal code is a five digits string, with two first digits between 01 and 52, assigned to provinces code.

class localflavor.es.forms.ESProvinceSelect(attrs=None)[source]

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

class localflavor.es.forms.ESRegionSelect(attrs=None)[source]

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

Models

class localflavor.es.models.ESIdentityCardNumberField(*args, **kwargs)[source]

A model field that stores Spanish NIF/NIE/CIF in format XXXXXXXXX

Forms represent it as form.ESIdentityCardNumberField field.

New in version 2.2.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value)[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class localflavor.es.models.ESPostalCodeField(*args, **kwargs)[source]

A model field that stores the five numbers (XXXXX) of Spain Postal Codes

Forms represent it as form.ESPostalCodeField

New in version 2.2.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

Data

localflavor.es.es_provinces.PROVINCE_CHOICES = (('01', 'Araba'), ('02', 'Albacete'), ('03', 'Alacant'), ('04', 'Almeria'), ('05', 'Avila'), ('06', 'Badajoz'), ('07', 'Illes Balears'), ('08', 'Barcelona'), ('09', 'Burgos'), ('10', 'Caceres'), ('11', 'Cadiz'), ('12', 'Castello'), ('13', 'Ciudad Real'), ('14', 'Cordoba'), ('15', 'A Coruna'), ('16', 'Cuenca'), ('17', 'Girona'), ('18', 'Granada'), ('19', 'Guadalajara'), ('20', 'Guipuzkoa'), ('21', 'Huelva'), ('22', 'Huesca'), ('23', 'Jaen'), ('24', 'Leon'), ('25', 'Lleida'), ('26', 'La Rioja'), ('27', 'Lugo'), ('28', 'Madrid'), ('29', 'Malaga'), ('30', 'Murcia'), ('31', 'Navarre'), ('32', 'Ourense'), ('33', 'Asturias'), ('34', 'Palencia'), ('35', 'Las Palmas'), ('36', 'Pontevedra'), ('37', 'Salamanca'), ('38', 'Santa Cruz de Tenerife'), ('39', 'Cantabria'), ('40', 'Segovia'), ('41', 'Seville'), ('42', 'Soria'), ('43', 'Tarragona'), ('44', 'Teruel'), ('45', 'Toledo'), ('46', 'Valencia'), ('47', 'Valladolid'), ('48', 'Bizkaia'), ('49', 'Zamora'), ('50', 'Zaragoza'), ('51', 'Ceuta'), ('52', 'Melilla'))

An alphabetical list of provinces

localflavor.es.es_regions.REGION_CHOICES = (('AN', 'Andalusia'), ('AR', 'Aragon'), ('O', 'Principality of Asturias'), ('IB', 'Balearic Islands'), ('PV', 'Basque Country'), ('CN', 'Canary Islands'), ('S', 'Cantabria'), ('CM', 'Castile-La Mancha'), ('CL', 'Castile and Leon'), ('CT', 'Catalonia'), ('EX', 'Extremadura'), ('GA', 'Galicia'), ('LO', 'La Rioja'), ('M', 'Madrid'), ('MU', 'Region of Murcia'), ('NA', 'Foral Community of Navarre'), ('VC', 'Valencian Community'), ('CE', 'Autonomous city of Ceuta'), ('ML', 'Autonomous city of Mellila'))

An alphabetical list of regions

Finland (fi)

Forms

FI-specific Form helpers.

class localflavor.fi.forms.FIMunicipalitySelect(attrs=None)[source]

A Select widget that uses a list of Finnish municipalities as its choices.

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

A form field that validates input as a Finnish social security number.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.fi.forms.FIZipCodeField(**kwargs)[source]

A form field that validates input as a Finnish zip code.

Valid codes consist of five digits.

Data

localflavor.fi.fi_municipalities.MUNICIPALITY_CHOICES = (('akaa', 'Akaa'), ('alajarvi', 'Alajärvi'), ('alavieska', 'Alavieska'), ('alavus', 'Alavus'), ('artjarvi', 'Artjärvi'), ('asikkala', 'Asikkala'), ('askola', 'Askola'), ('aura', 'Aura'), ('brando', 'Brändö'), ('eckero', 'Eckerö'), ('enonkoski', 'Enonkoski'), ('enontekio', 'Enontekiö'), ('espoo', 'Espoo'), ('eura', 'Eura'), ('eurajoki', 'Eurajoki'), ('evijarvi', 'Evijärvi'), ('finstrom', 'Finström'), ('forssa', 'Forssa'), ('foglo', 'Föglö'), ('geta', 'Geta'), ('haapajarvi', 'Haapajärvi'), ('haapavesi', 'Haapavesi'), ('hailuoto', 'Hailuoto'), ('halsua', 'Halsua'), ('hamina', 'Hamina'), ('hammarland', 'Hammarland'), ('hankasalmi', 'Hankasalmi'), ('hanko', 'Hanko'), ('harjavalta', 'Harjavalta'), ('hartola', 'Hartola'), ('hattula', 'Hattula'), ('haukipudas', 'Haukipudas'), ('hausjarvi', 'Hausjärvi'), ('heinola', 'Heinola'), ('heinavesi', 'Heinävesi'), ('helsinki', 'Helsinki'), ('hirvensalmi', 'Hirvensalmi'), ('hollola', 'Hollola'), ('honkajoki', 'Honkajoki'), ('huittinen', 'Huittinen'), ('humppila', 'Humppila'), ('hyrynsalmi', 'Hyrynsalmi'), ('hyvinkaa', 'Hyvinkää'), ('hameenkoski', 'Hämeenkoski'), ('hameenkyro', 'Hämeenkyrö'), ('hameenlinna', 'Hämeenlinna'), ('ii', 'Ii'), ('iisalmi', 'Iisalmi'), ('iitti', 'Iitti'), ('ikaalinen', 'Ikaalinen'), ('ilmajoki', 'Ilmajoki'), ('ilomantsi', 'Ilomantsi'), ('imatra', 'Imatra'), ('inari', 'Inari'), ('inkoo', 'Inkoo'), ('isojoki', 'Isojoki'), ('isokyro', 'Isokyrö'), ('jalasjarvi', 'Jalasjärvi'), ('janakkala', 'Janakkala'), ('joensuu', 'Joensuu'), ('jokioinen', 'Jokioinen'), ('jomala', 'Jomala'), ('joroinen', 'Joroinen'), ('joutsa', 'Joutsa'), ('juankoski', 'Juankoski'), ('juuka', 'Juuka'), ('juupajoki', 'Juupajoki'), ('juva', 'Juva'), ('jyvaskyla', 'Jyväskylä'), ('jamijarvi', 'Jämijärvi'), ('jamsa', 'Jämsä'), ('jarvenpaa', 'Järvenpää'), ('kaarina', 'Kaarina'), ('kaavi', 'Kaavi'), ('kajaani', 'Kajaani'), ('kalajoki', 'Kalajoki'), ('kangasala', 'Kangasala'), ('kangasniemi', 'Kangasniemi'), ('kankaanpaa', 'Kankaanpää'), ('kannonkoski', 'Kannonkoski'), ('kannus', 'Kannus'), ('karijoki', 'Karijoki'), ('karjalohja', 'Karjalohja'), ('karkkila', 'Karkkila'), ('karstula', 'Karstula'), ('karttula', 'Karttula'), ('karvia', 'Karvia'), ('kaskinen', 'Kaskinen'), ('kauhajoki', 'Kauhajoki'), ('kauhava', 'Kauhava'), ('kauniainen', 'Kauniainen'), ('kaustinen', 'Kaustinen'), ('keitele', 'Keitele'), ('kemi', 'Kemi'), ('kemijarvi', 'Kemijärvi'), ('keminmaa', 'Keminmaa'), ('kemionsaari', 'Kemiönsaari'), ('kempele', 'Kempele'), ('kerava', 'Kerava'), ('kerimaki', 'Kerimäki'), ('kesalahti', 'Kesälahti'), ('keuruu', 'Keuruu'), ('kihnio', 'Kihniö'), ('kiikoinen', 'Kiikoinen'), ('kiiminki', 'Kiiminki'), ('kinnula', 'Kinnula'), ('kirkkonummi', 'Kirkkonummi'), ('kitee', 'Kitee'), ('kittila', 'Kittilä'), ('kiuruvesi', 'Kiuruvesi'), ('kivijarvi', 'Kivijärvi'), ('kokemaki', 'Kokemäki'), ('kokkola', 'Kokkola'), ('kolari', 'Kolari'), ('konnevesi', 'Konnevesi'), ('kontiolahti', 'Kontiolahti'), ('korsnas', 'Korsnäs'), ('koskitl', 'Koski Tl'), ('kotka', 'Kotka'), ('kouvola', 'Kouvola'), ('kristiinankaupunki', 'Kristiinankaupunki'), ('kruunupyy', 'Kruunupyy'), ('kuhmalahti', 'Kuhmalahti'), ('kuhmo', 'Kuhmo'), ('kuhmoinen', 'Kuhmoinen'), ('kumlinge', 'Kumlinge'), ('kuopio', 'Kuopio'), ('kuortane', 'Kuortane'), ('kurikka', 'Kurikka'), ('kustavi', 'Kustavi'), ('kuusamo', 'Kuusamo'), ('kylmakoski', 'Kylmäkoski'), ('kyyjarvi', 'Kyyjärvi'), ('karkola', 'Kärkölä'), ('karsamaki', 'Kärsämäki'), ('kokar', 'Kökar'), ('koylio', 'Köyliö'), ('lahti', 'Lahti'), ('laihia', 'Laihia'), ('laitila', 'Laitila'), ('lapinjarvi', 'Lapinjärvi'), ('lapinlahti', 'Lapinlahti'), ('lappajarvi', 'Lappajärvi'), ('lappeenranta', 'Lappeenranta'), ('lapua', 'Lapua'), ('laukaa', 'Laukaa'), ('lavia', 'Lavia'), ('lemi', 'Lemi'), ('lemland', 'Lemland'), ('lempaala', 'Lempäälä'), ('leppavirta', 'Leppävirta'), ('lestijarvi', 'Lestijärvi'), ('lieksa', 'Lieksa'), ('lieto', 'Lieto'), ('liminka', 'Liminka'), ('liperi', 'Liperi'), ('lohja', 'Lohja'), ('loimaa', 'Loimaa'), ('loppi', 'Loppi'), ('loviisa', 'Loviisa'), ('luhanka', 'Luhanka'), ('lumijoki', 'Lumijoki'), ('lumparland', 'Lumparland'), ('luoto', 'Luoto'), ('luumaki', 'Luumäki'), ('luvia', 'Luvia'), ('lansi-turunmaa', 'Länsi-Turunmaa'), ('maalahti', 'Maalahti'), ('maaninka', 'Maaninka'), ('maarianhamina', 'Maarianhamina'), ('marttila', 'Marttila'), ('masku', 'Masku'), ('merijarvi', 'Merijärvi'), ('merikarvia', 'Merikarvia'), ('miehikkala', 'Miehikkälä'), ('mikkeli', 'Mikkeli'), ('muhos', 'Muhos'), ('multia', 'Multia'), ('muonio', 'Muonio'), ('mustasaari', 'Mustasaari'), ('muurame', 'Muurame'), ('mynamaki', 'Mynämäki'), ('myrskyla', 'Myrskylä'), ('mantsala', 'Mäntsälä'), ('mantta-vilppula', 'Mänttä-Vilppula'), ('mantyharju', 'Mäntyharju'), ('naantali', 'Naantali'), ('nakkila', 'Nakkila'), ('nastola', 'Nastola'), ('nilsia', 'Nilsiä'), ('nivala', 'Nivala'), ('nokia', 'Nokia'), ('nousiainen', 'Nousiainen'), ('nummi-pusula', 'Nummi-Pusula'), ('nurmes', 'Nurmes'), ('nurmijarvi', 'Nurmijärvi'), ('narpio', 'Närpiö'), ('oravainen', 'Oravainen'), ('orimattila', 'Orimattila'), ('oripaa', 'Oripää'), ('orivesi', 'Orivesi'), ('oulainen', 'Oulainen'), ('oulu', 'Oulu'), ('oulunsalo', 'Oulunsalo'), ('outokumpu', 'Outokumpu'), ('padasjoki', 'Padasjoki'), ('paimio', 'Paimio'), ('paltamo', 'Paltamo'), ('parikkala', 'Parikkala'), ('parkano', 'Parkano'), ('pedersore', 'Pedersöre'), ('pelkosenniemi', 'Pelkosenniemi'), ('pello', 'Pello'), ('perho', 'Perho'), ('pertunmaa', 'Pertunmaa'), ('petajavesi', 'Petäjävesi'), ('pieksamaki', 'Pieksämäki'), ('pielavesi', 'Pielavesi'), ('pietarsaari', 'Pietarsaari'), ('pihtipudas', 'Pihtipudas'), ('pirkkala', 'Pirkkala'), ('polvijarvi', 'Polvijärvi'), ('pomarkku', 'Pomarkku'), ('pori', 'Pori'), ('pornainen', 'Pornainen'), ('porvoo', 'Porvoo'), ('posio', 'Posio'), ('pudasjarvi', 'Pudasjärvi'), ('pukkila', 'Pukkila'), ('punkaharju', 'Punkaharju'), ('punkalaidun', 'Punkalaidun'), ('puolanka', 'Puolanka'), ('puumala', 'Puumala'), ('pyhtaa', 'Pyhtää'), ('pyhajoki', 'Pyhäjoki'), ('pyhajarvi', 'Pyhäjärvi'), ('pyhanta', 'Pyhäntä'), ('pyharanta', 'Pyhäranta'), ('palkane', 'Pälkäne'), ('poytya', 'Pöytyä'), ('raahe', 'Raahe'), ('raasepori', 'Raasepori'), ('raisio', 'Raisio'), ('rantasalmi', 'Rantasalmi'), ('ranua', 'Ranua'), ('rauma', 'Rauma'), ('rautalampi', 'Rautalampi'), ('rautavaara', 'Rautavaara'), ('rautjarvi', 'Rautjärvi'), ('reisjarvi', 'Reisjärvi'), ('riihimaki', 'Riihimäki'), ('ristiina', 'Ristiina'), ('ristijarvi', 'Ristijärvi'), ('rovaniemi', 'Rovaniemi'), ('ruokolahti', 'Ruokolahti'), ('ruovesi', 'Ruovesi'), ('rusko', 'Rusko'), ('raakkyla', 'Rääkkylä'), ('saarijarvi', 'Saarijärvi'), ('salla', 'Salla'), ('salo', 'Salo'), ('saltvik', 'Saltvik'), ('sastamala', 'Sastamala'), ('sauvo', 'Sauvo'), ('savitaipale', 'Savitaipale'), ('savonlinna', 'Savonlinna'), ('savukoski', 'Savukoski'), ('seinajoki', 'Seinäjoki'), ('sievi', 'Sievi'), ('siikainen', 'Siikainen'), ('siikajoki', 'Siikajoki'), ('siikalatva', 'Siikalatva'), ('siilinjarvi', 'Siilinjärvi'), ('simo', 'Simo'), ('sipoo', 'Sipoo'), ('siuntio', 'Siuntio'), ('sodankyla', 'Sodankylä'), ('soini', 'Soini'), ('somero', 'Somero'), ('sonkajarvi', 'Sonkajärvi'), ('sotkamo', 'Sotkamo'), ('sottunga', 'Sottunga'), ('sulkava', 'Sulkava'), ('sund', 'Sund'), ('suomenniemi', 'Suomenniemi'), ('suomussalmi', 'Suomussalmi'), ('suonenjoki', 'Suonenjoki'), ('sysma', 'Sysmä'), ('sakyla', 'Säkylä'), ('taipalsaari', 'Taipalsaari'), ('taivalkoski', 'Taivalkoski'), ('taivassalo', 'Taivassalo'), ('tammela', 'Tammela'), ('tampere', 'Tampere'), ('tarvasjoki', 'Tarvasjoki'), ('tervo', 'Tervo'), ('tervola', 'Tervola'), ('teuva', 'Teuva'), ('tohmajarvi', 'Tohmajärvi'), ('toholampi', 'Toholampi'), ('toivakka', 'Toivakka'), ('tornio', 'Tornio'), ('turku', 'Turku'), ('tuusniemi', 'Tuusniemi'), ('tuusula', 'Tuusula'), ('tyrnava', 'Tyrnävä'), ('toysa', 'Töysä'), ('ulvila', 'Ulvila'), ('urjala', 'Urjala'), ('utajarvi', 'Utajärvi'), ('utsjoki', 'Utsjoki'), ('uurainen', 'Uurainen'), ('uusikaarlepyy', 'Uusikaarlepyy'), ('uusikaupunki', 'Uusikaupunki'), ('vaala', 'Vaala'), ('vaasa', 'Vaasa'), ('valkeakoski', 'Valkeakoski'), ('valtimo', 'Valtimo'), ('vantaa', 'Vantaa'), ('varkaus', 'Varkaus'), ('varpaisjarvi', 'Varpaisjärvi'), ('vehmaa', 'Vehmaa'), ('vesanto', 'Vesanto'), ('vesilahti', 'Vesilahti'), ('veteli', 'Veteli'), ('vierema', 'Vieremä'), ('vihanti', 'Vihanti'), ('vihti', 'Vihti'), ('viitasaari', 'Viitasaari'), ('vimpeli', 'Vimpeli'), ('virolahti', 'Virolahti'), ('virrat', 'Virrat'), ('vardo', 'Vårdö'), ('vahakyro', 'Vähäkyrö'), ('voyri-maksamaa', 'Vöyri-Maksamaa'), ('yli-ii', 'Yli-Ii'), ('ylitornio', 'Ylitornio'), ('ylivieska', 'Ylivieska'), ('ylojarvi', 'Ylöjärvi'), ('ypaja', 'Ypäjä'), ('ahtari', 'Ähtäri'), ('aanekoski', 'Äänekoski'))

An alphabetical list of Finnish municipalities for use as choices in a formfield.

France (fr)

Forms

FR-specific Form helpers

class localflavor.fr.forms.FRDepartmentField(**kwargs)[source]

A Select Field that uses a FRDepartmentSelect widget.

widget

alias of FRDepartmentSelect

class localflavor.fr.forms.FRDepartmentSelect(attrs=None)[source]

A Select widget that uses a list of FR departments as its choices.

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

Validates input as a French National Identification number.

Validation of the Number, and checksum calculation is detailed at http://en.wikipedia.org/wiki/INSEE_code

Complete spec of the codification is detailed here:

New in version 1.1.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

RNA Stands for “Répertoire National des Associations”

It’s under the authority of the French Minister of the Interior. See https://fr.wikipedia.org/wiki/R%C3%A9pertoire_national_des_associations for more information.

New in version 4.0.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.fr.forms.FRRegion2016Select(attrs=None)[source]

A Select widget that uses a list of France’s New Regions as its choices.

class localflavor.fr.forms.FRRegionField(**kwargs)[source]

A Select Field that uses a FRRegionSelect widget.

widget

alias of FRRegionSelect

class localflavor.fr.forms.FRRegionSelect(attrs=None)[source]

A Select widget that uses a list of FR Regions as its choices.

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

SIREN stands for “Système d’identification du répertoire des entreprises”.

It’s under authority of the INSEE. See http://fr.wikipedia.org/wiki/Système_d’identification_du_répertoire_des_entreprises for more information.

New in version 1.1.

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

SIRET stands for “Système d’identification du répertoire des établissements”.

It’s under authority of the INSEE. See http://fr.wikipedia.org/wiki/Système_d’identification_du_répertoire_des_établissements for more information.

New in version 1.1.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.fr.forms.FRZipCodeField(**kwargs)[source]

Validate local French zip code.

The correct format is ‘XXXXX’.

Data

localflavor.fr.fr_department.DEPARTMENT_CHOICES_PER_REGION = (('01', 'Ain', '82'), ('02', 'Aisne', '22'), ('03', 'Allier', '83'), ('04', 'Alpes-de-Haute-Provence', '93'), ('05', 'Hautes-Alpes', '93'), ('06', 'Alpes-Maritimes', '93'), ('07', 'Ardèche', '82'), ('08', 'Ardennes', '21'), ('09', 'Ariège', '73'), ('10', 'Aube', '21'), ('11', 'Aude', '91'), ('12', 'Aveyron', '73'), ('13', 'Bouches-du-Rhône', '93'), ('14', 'Calvados', '25'), ('15', 'Cantal', '83'), ('16', 'Charente', '54'), ('17', 'Charente-Maritime', '54'), ('18', 'Cher', '24'), ('19', 'Corrèze', '74'), ('2A', 'Corse-du-Sud', '94'), ('2B', 'Haute-Corse', '94'), ('21', "Côte-d'Or", '26'), ('22', "Côtes-d'Armor", '53'), ('23', 'Creuse', '74'), ('24', 'Dordogne', '72'), ('25', 'Doubs', '43'), ('26', 'Drôme', '82'), ('27', 'Eure', '23'), ('28', 'Eure-et-Loir', '24'), ('29', 'Finistère', '53'), ('30', 'Gard', '91'), ('31', 'Haute-Garonne', '73'), ('32', 'Gers', '73'), ('33', 'Gironde', '72'), ('34', 'Hérault', '91'), ('35', 'Ille-et-Vilaine', '53'), ('36', 'Indre', '24'), ('37', 'Indre-et-Loire', '24'), ('38', 'Isère', '82'), ('39', 'Jura', '43'), ('40', 'Landes', '72'), ('41', 'Loir-et-Cher', '24'), ('42', 'Loire', '82'), ('43', 'Haute-Loire', '83'), ('44', 'Loire-Atlantique', '52'), ('45', 'Loiret', '24'), ('46', 'Lot', '73'), ('47', 'Lot-et-Garonne', '72'), ('48', 'Lozère', '91'), ('49', 'Maine-et-Loire', '52'), ('50', 'Manche', '25'), ('51', 'Marne', '21'), ('52', 'Haute-Marne', '21'), ('53', 'Mayenne', '52'), ('54', 'Meurthe-et-Moselle', '41'), ('55', 'Meuse', '41'), ('56', 'Morbihan', '53'), ('57', 'Moselle', '41'), ('58', 'Nièvre', '26'), ('59', 'Nord', '31'), ('60', 'Oise', '22'), ('61', 'Orne', '25'), ('62', 'Pas-de-Calais', '31'), ('63', 'Puy-de-Dôme', '83'), ('64', 'Pyrénées-Atlantiques', '72'), ('65', 'Hautes-Pyrénées', '73'), ('66', 'Pyrénées-Orientales', '91'), ('67', 'Bas-Rhin', '42'), ('68', 'Haut-Rhin', '42'), ('69', 'Rhône', '82'), ('70', 'Haute-Saône', '43'), ('71', 'Saône-et-Loire', '26'), ('72', 'Sarthe', '52'), ('73', 'Savoie', '82'), ('74', 'Haute-Savoie', '82'), ('75', 'Paris', '11'), ('76', 'Seine-Maritime', '23'), ('77', 'Seine-et-Marne', '11'), ('78', 'Yvelines', '11'), ('79', 'Deux-Sèvres', '54'), ('80', 'Somme', '22'), ('81', 'Tarn', '73'), ('82', 'Tarn-et-Garonne', '73'), ('83', 'Var', '93'), ('84', 'Vaucluse', '93'), ('85', 'Vendée', '52'), ('86', 'Vienne', '54'), ('87', 'Haute-Vienne', '74'), ('88', 'Vosges', '41'), ('89', 'Yonne', '26'), ('90', 'Territoire de Belfort', '43'), ('91', 'Essonne', '11'), ('92', 'Hauts-de-Seine', '11'), ('93', 'Seine-Saint-Denis', '11'), ('94', 'Val-de-Marne', '11'), ('95', "Val-d'Oise", '11'), ('971', 'Guadeloupe', '01'), ('972', 'Martinique', '02'), ('973', 'Guyane', '03'), ('974', 'La Réunion', '04'), ('975', 'Saint-Pierre-et-Miquelon', None), ('976', 'Mayotte', '05'), ('977', 'Saint-Barthélemy', None), ('978', 'Saint-Martin', None), ('984', 'Terres australes et antarctiques françaises', None), ('986', 'Wallis et Futuna', None), ('987', 'Polynésie française', None), ('988', 'Nouvelle-Calédonie', None), ('989', 'Île de Clipperton', None))

See the “Code officiel géographique” on the INSEE website <www.insee.fr>.

localflavor.fr.fr_department.DEPARTMENT_CHOICES = (('01', '01 - Ain'), ('02', '02 - Aisne'), ('03', '03 - Allier'), ('04', '04 - Alpes-de-Haute-Provence'), ('05', '05 - Hautes-Alpes'), ('06', '06 - Alpes-Maritimes'), ('07', '07 - Ardèche'), ('08', '08 - Ardennes'), ('09', '09 - Ariège'), ('10', '10 - Aube'), ('11', '11 - Aude'), ('12', '12 - Aveyron'), ('13', '13 - Bouches-du-Rhône'), ('14', '14 - Calvados'), ('15', '15 - Cantal'), ('16', '16 - Charente'), ('17', '17 - Charente-Maritime'), ('18', '18 - Cher'), ('19', '19 - Corrèze'), ('2A', '2A - Corse-du-Sud'), ('2B', '2B - Haute-Corse'), ('21', "21 - Côte-d'Or"), ('22', "22 - Côtes-d'Armor"), ('23', '23 - Creuse'), ('24', '24 - Dordogne'), ('25', '25 - Doubs'), ('26', '26 - Drôme'), ('27', '27 - Eure'), ('28', '28 - Eure-et-Loir'), ('29', '29 - Finistère'), ('30', '30 - Gard'), ('31', '31 - Haute-Garonne'), ('32', '32 - Gers'), ('33', '33 - Gironde'), ('34', '34 - Hérault'), ('35', '35 - Ille-et-Vilaine'), ('36', '36 - Indre'), ('37', '37 - Indre-et-Loire'), ('38', '38 - Isère'), ('39', '39 - Jura'), ('40', '40 - Landes'), ('41', '41 - Loir-et-Cher'), ('42', '42 - Loire'), ('43', '43 - Haute-Loire'), ('44', '44 - Loire-Atlantique'), ('45', '45 - Loiret'), ('46', '46 - Lot'), ('47', '47 - Lot-et-Garonne'), ('48', '48 - Lozère'), ('49', '49 - Maine-et-Loire'), ('50', '50 - Manche'), ('51', '51 - Marne'), ('52', '52 - Haute-Marne'), ('53', '53 - Mayenne'), ('54', '54 - Meurthe-et-Moselle'), ('55', '55 - Meuse'), ('56', '56 - Morbihan'), ('57', '57 - Moselle'), ('58', '58 - Nièvre'), ('59', '59 - Nord'), ('60', '60 - Oise'), ('61', '61 - Orne'), ('62', '62 - Pas-de-Calais'), ('63', '63 - Puy-de-Dôme'), ('64', '64 - Pyrénées-Atlantiques'), ('65', '65 - Hautes-Pyrénées'), ('66', '66 - Pyrénées-Orientales'), ('67', '67 - Bas-Rhin'), ('68', '68 - Haut-Rhin'), ('69', '69 - Rhône'), ('70', '70 - Haute-Saône'), ('71', '71 - Saône-et-Loire'), ('72', '72 - Sarthe'), ('73', '73 - Savoie'), ('74', '74 - Haute-Savoie'), ('75', '75 - Paris'), ('76', '76 - Seine-Maritime'), ('77', '77 - Seine-et-Marne'), ('78', '78 - Yvelines'), ('79', '79 - Deux-Sèvres'), ('80', '80 - Somme'), ('81', '81 - Tarn'), ('82', '82 - Tarn-et-Garonne'), ('83', '83 - Var'), ('84', '84 - Vaucluse'), ('85', '85 - Vendée'), ('86', '86 - Vienne'), ('87', '87 - Haute-Vienne'), ('88', '88 - Vosges'), ('89', '89 - Yonne'), ('90', '90 - Territoire de Belfort'), ('91', '91 - Essonne'), ('92', '92 - Hauts-de-Seine'), ('93', '93 - Seine-Saint-Denis'), ('94', '94 - Val-de-Marne'), ('95', "95 - Val-d'Oise"), ('971', '971 - Guadeloupe'), ('972', '972 - Martinique'), ('973', '973 - Guyane'), ('974', '974 - La Réunion'), ('975', '975 - Saint-Pierre-et-Miquelon'), ('976', '976 - Mayotte'), ('977', '977 - Saint-Barthélemy'), ('978', '978 - Saint-Martin'), ('984', '984 - Terres australes et antarctiques françaises'), ('986', '986 - Wallis et Futuna'), ('987', '987 - Polynésie française'), ('988', '988 - Nouvelle-Calédonie'), ('989', '989 - Île de Clipperton'))

A list of departments

localflavor.fr.fr_region.REGION_CHOICES = (('01', 'Guadeloupe'), ('02', 'Martinique'), ('03', 'Guyane'), ('04', 'La Réunion'), ('05', 'Mayotte'), ('11', 'Île-de-France'), ('21', 'Champagne-Ardenne'), ('22', 'Picardie'), ('23', 'Haute-Normandie'), ('24', 'Centre'), ('25', 'Basse-Normandie'), ('26', 'Bourgogne'), ('31', 'Nord-Pas-de-Calais'), ('41', 'Lorraine'), ('42', 'Alsace'), ('43', 'Franche-Comté'), ('52', 'Pays de la Loire'), ('53', 'Bretagne'), ('54', 'Poitou-Charentes'), ('72', 'Aquitaine'), ('73', 'Midi-Pyrénées'), ('74', 'Limousin'), ('82', 'Rhône-Alpes'), ('83', 'Auvergne'), ('91', 'Languedoc-Roussillon'), ('93', "Provence-Alpes-Côte d'Azur"), ('94', 'Corse'))

See the “Code officiel géographique” on the INSEE website <www.insee.fr>.

localflavor.fr.fr_region.REGION_2016_CHOICES = (('01', 'Guadeloupe'), ('02', 'Martinique'), ('03', 'Guyane'), ('04', 'La Réunion'), ('06', 'Mayotte'), ('11', 'Île-de-France'), ('24', 'Centre-Val de Loire'), ('27', 'Bourgogne-Franche-Comté'), ('28', 'Normandie'), ('32', 'Hauts-de-France'), ('44', 'Grand Est'), ('52', 'Pays de la Loire'), ('53', 'Bretagne'), ('75', 'Nouvelle-Aquitaine'), ('76', 'Occitanie'), ('84', 'Auvergne-Rhône-Alpes'), ('93', "Provence-Alpes-Côte d'Azur"), ('94', 'Corse'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Great Britain (gb)

Forms

GB-specific Form helpers.

class localflavor.gb.forms.GBCountySelect(attrs=None)[source]

A Select widget that uses a list of UK Counties/Regions as its choices.

class localflavor.gb.forms.GBNationSelect(attrs=None)[source]

A Select widget that uses a list of UK Nations as its choices.

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

A form field that validates its input is a UK postcode.

The regular expression used is sourced from the schema for British Standard BS7666 address types: https://data.gov.uk/education-standards/sites/default/files/CL-Address-Line-Type-v3-0.pdf

The value is uppercased and a space added in the correct place, if required.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Data

This module contains various lists of regions and subdivisions in Great Britain.

Since subdivisions aren’t clear this is supposed to be the most pragmatic collection of lists as possible. Your mileage may vary.

See https://github.com/django/django-localflavor/pull/43 for a long discussion about it.

Changed in version 1.1.

localflavor.gb.gb_regions.ENGLAND_REGION_CHOICES = (('Bath and North East Somerset', 'Bath and North East Somerset'), ('Bedford', 'Bedford'), ('Berkshire', 'Berkshire'), ('Blackburn with Darwen', 'Blackburn with Darwen'), ('Blackpool', 'Blackpool'), ('Bournemouth', 'Bournemouth'), ('Brighton & Hove', 'Brighton & Hove'), ('Bristol', 'Bristol'), ('Buckinghamshire', 'Buckinghamshire'), ('Cambridgeshire', 'Cambridgeshire'), ('Central Bedfordshire', 'Central Bedfordshire'), ('Cheshire East', 'Cheshire East'), ('Cheshire West and Chester', 'Cheshire West and Chester'), ('Cornwall', 'Cornwall'), ('Cumbria', 'Cumbria'), ('Darlington', 'Darlington'), ('Derby', 'Derby'), ('Derbyshire', 'Derbyshire'), ('Devon', 'Devon'), ('Dorset', 'Dorset'), ('Durham', 'Durham'), ('East Riding of Yorkshire', 'East Riding of Yorkshire'), ('East Sussex', 'East Sussex'), ('Essex', 'Essex'), ('Gloucestershire', 'Gloucestershire'), ('Greater Manchester', 'Greater Manchester'), ('Halton', 'Halton'), ('Hampshire', 'Hampshire'), ('Hartlepool', 'Hartlepool'), ('Herefordshire', 'Herefordshire'), ('Hertfordshire', 'Hertfordshire'), ('Isle of Wight', 'Isle of Wight'), ('Kent', 'Kent'), ('Kingston upon Hull', 'Kingston upon Hull'), ('Lancashire', 'Lancashire'), ('Leicester', 'Leicester'), ('Leicestershire', 'Leicestershire'), ('Lincolnshire', 'Lincolnshire'), ('London', 'London'), ('Luton', 'Luton'), ('Medway', 'Medway'), ('Merseyside', 'Merseyside'), ('Middlesbrough', 'Middlesbrough'), ('Milton Keynes', 'Milton Keynes'), ('Norfolk', 'Norfolk'), ('North East Lincolnshire', 'North East Lincolnshire'), ('North Lincolnshire', 'North Lincolnshire'), ('North Somerset', 'North Somerset'), ('North Yorkshire', 'North Yorkshire'), ('Northamptonshire', 'Northamptonshire'), ('Northumberland', 'Northumberland'), ('Nottingham', 'Nottingham'), ('Nottinghamshire', 'Nottinghamshire'), ('Oxfordshire', 'Oxfordshire'), ('Peterborough', 'Peterborough'), ('Plymouth', 'Plymouth'), ('Poole', 'Poole'), ('Portsmouth', 'Portsmouth'), ('Redcar and Cleveland', 'Redcar and Cleveland'), ('Rutland', 'Rutland'), ('Shropshire', 'Shropshire'), ('Somerset', 'Somerset'), ('South Gloucestershire', 'South Gloucestershire'), ('South Yorkshire', 'South Yorkshire'), ('Southampton', 'Southampton'), ('Southend-on-Sea', 'Southend-on-Sea'), ('Staffordshire', 'Staffordshire'), ('Stockton-on-Tees', 'Stockton-on-Tees'), ('Stoke-on-Trent', 'Stoke-on-Trent'), ('Suffolk', 'Suffolk'), ('Surrey', 'Surrey'), ('Swindon', 'Swindon'), ('Telford and Wrekin', 'Telford and Wrekin'), ('Thurrock', 'Thurrock'), ('Torbay', 'Torbay'), ('Tyne and Wear', 'Tyne and Wear'), ('Warrington', 'Warrington'), ('Warwickshire', 'Warwickshire'), ('West Midlands', 'West Midlands'), ('West Sussex', 'West Sussex'), ('West Yorkshire', 'West Yorkshire'), ('Wiltshire', 'Wiltshire'), ('Worcestershire', 'Worcestershire'), ('York', 'York'))

Metropolitan and non-metropolitan counties of England (not the ceremonial counties) Retrieved 10th Nov 2014 from http://en.wikipedia.org/wiki/Metropolitan_and_non-metropolitan_counties_of_England

localflavor.gb.gb_regions.GB_NATIONS_CHOICES = (('England', 'England'), ('Northern Ireland', 'Northern Ireland'), ('Wales', 'Wales'), ('Scotland', 'Scotland'))

Nations of the United Kingdom

localflavor.gb.gb_regions.GB_REGION_CHOICES = (('Bath and North East Somerset', 'Bath and North East Somerset'), ('Bedford', 'Bedford'), ('Berkshire', 'Berkshire'), ('Blackburn with Darwen', 'Blackburn with Darwen'), ('Blackpool', 'Blackpool'), ('Bournemouth', 'Bournemouth'), ('Brighton & Hove', 'Brighton & Hove'), ('Bristol', 'Bristol'), ('Buckinghamshire', 'Buckinghamshire'), ('Cambridgeshire', 'Cambridgeshire'), ('Central Bedfordshire', 'Central Bedfordshire'), ('Cheshire East', 'Cheshire East'), ('Cheshire West and Chester', 'Cheshire West and Chester'), ('Cornwall', 'Cornwall'), ('Cumbria', 'Cumbria'), ('Darlington', 'Darlington'), ('Derby', 'Derby'), ('Derbyshire', 'Derbyshire'), ('Devon', 'Devon'), ('Dorset', 'Dorset'), ('Durham', 'Durham'), ('East Riding of Yorkshire', 'East Riding of Yorkshire'), ('East Sussex', 'East Sussex'), ('Essex', 'Essex'), ('Gloucestershire', 'Gloucestershire'), ('Greater Manchester', 'Greater Manchester'), ('Halton', 'Halton'), ('Hampshire', 'Hampshire'), ('Hartlepool', 'Hartlepool'), ('Herefordshire', 'Herefordshire'), ('Hertfordshire', 'Hertfordshire'), ('Isle of Wight', 'Isle of Wight'), ('Kent', 'Kent'), ('Kingston upon Hull', 'Kingston upon Hull'), ('Lancashire', 'Lancashire'), ('Leicester', 'Leicester'), ('Leicestershire', 'Leicestershire'), ('Lincolnshire', 'Lincolnshire'), ('London', 'London'), ('Luton', 'Luton'), ('Medway', 'Medway'), ('Merseyside', 'Merseyside'), ('Middlesbrough', 'Middlesbrough'), ('Milton Keynes', 'Milton Keynes'), ('Norfolk', 'Norfolk'), ('North East Lincolnshire', 'North East Lincolnshire'), ('North Lincolnshire', 'North Lincolnshire'), ('North Somerset', 'North Somerset'), ('North Yorkshire', 'North Yorkshire'), ('Northamptonshire', 'Northamptonshire'), ('Northumberland', 'Northumberland'), ('Nottingham', 'Nottingham'), ('Nottinghamshire', 'Nottinghamshire'), ('Oxfordshire', 'Oxfordshire'), ('Peterborough', 'Peterborough'), ('Plymouth', 'Plymouth'), ('Poole', 'Poole'), ('Portsmouth', 'Portsmouth'), ('Redcar and Cleveland', 'Redcar and Cleveland'), ('Rutland', 'Rutland'), ('Shropshire', 'Shropshire'), ('Somerset', 'Somerset'), ('South Gloucestershire', 'South Gloucestershire'), ('South Yorkshire', 'South Yorkshire'), ('Southampton', 'Southampton'), ('Southend-on-Sea', 'Southend-on-Sea'), ('Staffordshire', 'Staffordshire'), ('Stockton-on-Tees', 'Stockton-on-Tees'), ('Stoke-on-Trent', 'Stoke-on-Trent'), ('Suffolk', 'Suffolk'), ('Surrey', 'Surrey'), ('Swindon', 'Swindon'), ('Telford and Wrekin', 'Telford and Wrekin'), ('Thurrock', 'Thurrock'), ('Torbay', 'Torbay'), ('Tyne and Wear', 'Tyne and Wear'), ('Warrington', 'Warrington'), ('Warwickshire', 'Warwickshire'), ('West Midlands', 'West Midlands'), ('West Sussex', 'West Sussex'), ('West Yorkshire', 'West Yorkshire'), ('Wiltshire', 'Wiltshire'), ('Worcestershire', 'Worcestershire'), ('York', 'York'), ('Antrim', 'Antrim'), ('Armagh', 'Armagh'), ('Down', 'Down'), ('Fermanagh', 'Fermanagh'), ('Londonderry', 'Londonderry'), ('Tyrone', 'Tyrone'), ('Blaenau Gwent', 'Blaenau Gwent'), ('Bridgend', 'Bridgend'), ('Caerphilly', 'Caerphilly'), ('Cardiff', 'Cardiff'), ('Carmarthenshire', 'Carmarthenshire'), ('Ceredigion', 'Ceredigion'), ('Conwy', 'Conwy'), ('Denbighshire', 'Denbighshire'), ('Flintshire', 'Flintshire'), ('Gwynedd', 'Gwynedd'), ('Isle of Anglesey', 'Isle of Anglesey'), ('Merthyr Tydfil', 'Merthyr Tydfil'), ('Monmouthshire', 'Monmouthshire'), ('Neath Port Talbot', 'Neath Port Talbot'), ('Newport', 'Newport'), ('Pembrokeshire', 'Pembrokeshire'), ('Powys', 'Powys'), ('Rhondda Cynon Taf', 'Rhondda Cynon Taf'), ('Swansea', 'Swansea'), ('Torfaen', 'Torfaen'), ('Vale of Glamorgan', 'Vale of Glamorgan'), ('Wrexham', 'Wrexham'), ('Aberdeen City', 'Aberdeen City'), ('Aberdeenshire', 'Aberdeenshire'), ('Angus', 'Angus'), ('Argyll and Bute', 'Argyll and Bute'), ('Clackmannanshire', 'Clackmannanshire'), ('Dumfries and Galloway', 'Dumfries and Galloway'), ('Dundee City', 'Dundee City'), ('East Ayrshire', 'East Ayrshire'), ('East Dunbartonshire', 'East Dunbartonshire'), ('East Lothian', 'East Lothian'), ('East Renfrewshire', 'East Renfrewshire'), ('Edinburgh, City of ', 'Edinburgh, City of'), ('Falkirk', 'Falkirk'), ('Fife', 'Fife'), ('Glasgow City', 'Glasgow City'), ('Highland', 'Highland'), ('Inverclyde', 'Inverclyde'), ('Midlothian', 'Midlothian'), ('Moray', 'Moray'), ('North Ayrshire', 'North Ayrshire'), ('North Lanarkshire', 'North Lanarkshire'), ('Perth and Kinross', 'Perth and Kinross'), ('Renfrewshire', 'Renfrewshire'), ('Scottish Borders', 'Scottish Borders'), ('South Ayrshire', 'South Ayrshire'), ('South Lanarkshire', 'South Lanarkshire'), ('Stirling', 'Stirling'), ('West Dunbartonshire', 'West Dunbartonshire'), ('West Lothian', 'West Lothian'), ('Na h-Eileanan Siar', 'Na h-Eileanan Siar'), ('Orkney Islands', 'Orkney Islands'), ('Shetland Islands', 'Shetland Islands'))

All regions of United Kingdom

localflavor.gb.gb_regions.NORTHERN_IRELAND_REGION_CHOICES = (('Antrim', 'Antrim'), ('Armagh', 'Armagh'), ('Down', 'Down'), ('Fermanagh', 'Fermanagh'), ('Londonderry', 'Londonderry'), ('Tyrone', 'Tyrone'))

Counties of Northern Ireland (not the more recent, but less well-known, districts of Northern Ireland) Retrieved 10th Nov 2014 from http://en.wikipedia.org/wiki/Counties_of_Northern_Ireland

localflavor.gb.gb_regions.SCOTTISH_REGION_CHOICES = (('Aberdeen City', 'Aberdeen City'), ('Aberdeenshire', 'Aberdeenshire'), ('Angus', 'Angus'), ('Argyll and Bute', 'Argyll and Bute'), ('Clackmannanshire', 'Clackmannanshire'), ('Dumfries and Galloway', 'Dumfries and Galloway'), ('Dundee City', 'Dundee City'), ('East Ayrshire', 'East Ayrshire'), ('East Dunbartonshire', 'East Dunbartonshire'), ('East Lothian', 'East Lothian'), ('East Renfrewshire', 'East Renfrewshire'), ('Edinburgh, City of ', 'Edinburgh, City of'), ('Falkirk', 'Falkirk'), ('Fife', 'Fife'), ('Glasgow City', 'Glasgow City'), ('Highland', 'Highland'), ('Inverclyde', 'Inverclyde'), ('Midlothian', 'Midlothian'), ('Moray', 'Moray'), ('North Ayrshire', 'North Ayrshire'), ('North Lanarkshire', 'North Lanarkshire'), ('Perth and Kinross', 'Perth and Kinross'), ('Renfrewshire', 'Renfrewshire'), ('Scottish Borders', 'Scottish Borders'), ('South Ayrshire', 'South Ayrshire'), ('South Lanarkshire', 'South Lanarkshire'), ('Stirling', 'Stirling'), ('West Dunbartonshire', 'West Dunbartonshire'), ('West Lothian', 'West Lothian'), ('Na h-Eileanan Siar', 'Na h-Eileanan Siar'), ('Orkney Islands', 'Orkney Islands'), ('Shetland Islands', 'Shetland Islands'))

Council areas of Scotland Retrieved 10th Nov 2014 from http://en.wikipedia.org/wiki/Subdivisions_of_Scotland#Council_areas

localflavor.gb.gb_regions.WALES_REGION_CHOICES = (('Blaenau Gwent', 'Blaenau Gwent'), ('Bridgend', 'Bridgend'), ('Caerphilly', 'Caerphilly'), ('Cardiff', 'Cardiff'), ('Carmarthenshire', 'Carmarthenshire'), ('Ceredigion', 'Ceredigion'), ('Conwy', 'Conwy'), ('Denbighshire', 'Denbighshire'), ('Flintshire', 'Flintshire'), ('Gwynedd', 'Gwynedd'), ('Isle of Anglesey', 'Isle of Anglesey'), ('Merthyr Tydfil', 'Merthyr Tydfil'), ('Monmouthshire', 'Monmouthshire'), ('Neath Port Talbot', 'Neath Port Talbot'), ('Newport', 'Newport'), ('Pembrokeshire', 'Pembrokeshire'), ('Powys', 'Powys'), ('Rhondda Cynon Taf', 'Rhondda Cynon Taf'), ('Swansea', 'Swansea'), ('Torfaen', 'Torfaen'), ('Vale of Glamorgan', 'Vale of Glamorgan'), ('Wrexham', 'Wrexham'))

Principal areas of Wales (not the preserved or historic counties) Retrieved 10th Nov 2014 from http://en.wikipedia.org/wiki/Local_government_in_Wales

Ghana (gh)

Forms

Ghana specific form helpers.

class localflavor.gh.forms.GHRegionSelect(attrs=None)[source]

A Select widget with option to select a region from list of all regions of Ghana.

Data

localflavor.gh.gh_regions.REGIONS = [('ahafo', 'Ahafo'), ('ashanti', 'Ashanti'), ('bono_east', 'Bono East'), ('brong_ahafo', 'Brong Ahafo'), ('central', 'Central'), ('eastern', 'Eastern'), ('greater_accra', 'Greater Accra'), ('north_east', 'North East'), ('northern', 'Northern'), ('oti', 'Oti'), ('savannah', 'Savannah'), ('upper_east', 'Upper East'), ('upper_west', 'Upper West'), ('western', 'Western'), ('western_north', 'Western North'), ('volta', 'Volta')]

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

Greece (gr)

Forms

Greek-specific forms helpers.

class localflavor.gr.forms.GRPostalCodeField(**kwargs)[source]

Greek Postal code field.

Format: XXXXX, where X is any digit, and first digit is not 0 or 9.

class localflavor.gr.forms.GRSocialSecurityNumberCodeField(allow_test_value=False, **kwargs)[source]

Greek social security number (AMKA) field.

The allow_test_value option can be used to enable the usage of the non valid 00000000000 (11 zeros) value for testing and development

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.gr.forms.GRTaxNumberCodeField(allow_test_value=False, **kwargs)[source]

Greek tax number field.

The allow_test_value option can be used to enable the usage of the non valid 000000000 value for testing and development

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Croatia (hr)

Forms

HR-specific Form helpers.

class localflavor.hr.forms.HRCountySelect(attrs=None)[source]

A Select widget that uses a list of counties of Croatia as its choices.

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

Unique Master Academic Citizen Number of Croatia (JMBAG) field.

This number is used by college students and professors in Croatia.

http://www.cap.srce.hr/IzgledX.aspx

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

Unique Master Citizen Number (JMBG) field.

The number is still in use in Croatia, but it is being replaced by OIB.

Source: http://en.wikipedia.org/wiki/Unique_Master_Citizen_Number

For who might be reimplementing: The “area” regular expression group is used to calculate the region where a person was registered. Additional validation can be implemented in accordance with it, however this could result in exclusion of legit immigrated citizens. Therefore, this field works for any ex-Yugoslavia country.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

Vehicle license plate of Croatia field.

Normalizes to the specific format below. Suffix is constructed from the shared letters of the Croatian and English alphabets.

Format examples:
SB 123-A (but also supports more characters) ZG 1234-AA

Used for standardized license plates only.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.hr.forms.HRLicensePlatePrefixSelect(attrs=None)[source]

A Select widget that uses a list of vehicle license plate prefixes of Croatia as its choices.

class localflavor.hr.forms.HROIBField(min_length=11, max_length=11, **kwargs)[source]

Personal Identification Number of Croatia (OIB) field.

http://www.oib.hr/

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

Postal code of Croatia field.

It consists of exactly five digits ranging from 10000 to possibly less than 60000.

http://www.posta.hr/main.aspx?id=66

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Data

localflavor.hr.hr_choices.HR_COUNTY_CHOICES = (('GZG', 'Grad Zagreb'), ('BBŽ', 'Bjelovarsko-bilogorska županija'), ('BPŽ', 'Brodsko-posavska županija'), ('DNŽ', 'Dubrovačko-neretvanska županija'), ('IŽ', 'Istarska županija'), ('KŽ', 'Karlovačka županija'), ('KKŽ', 'Koprivničko-križevačka županija'), ('KZŽ', 'Krapinsko-zagorska županija'), ('LSŽ', 'Ličko-senjska županija'), ('MŽ', 'Međimurska županija'), ('OBŽ', 'Osječko-baranjska županija'), ('PSŽ', 'Požeško-slavonska županija'), ('PGŽ', 'Primorsko-goranska županija'), ('SMŽ', 'Sisačko-moslavačka županija'), ('SDŽ', 'Splitsko-dalmatinska županija'), ('ŠKŽ', 'Šibensko-kninska županija'), ('VŽ', 'Varaždinska županija'), ('VPŽ', 'Virovitičko-podravska županija'), ('VSŽ', 'Vukovarsko-srijemska županija'), ('ZDŽ', 'Zadarska županija'), ('ZGŽ', 'Zagrebačka županija'))

Croatian Counties: http://en.wikipedia.org/wiki/ISO_3166-2:HR Croatia doesn’t have official abbreviations for counties. The ones provided are in common use.

localflavor.hr.hr_choices.HR_LICENSE_PLATE_PREFIX_CHOICES = (('BJ', 'BJ'), ('BM', 'BM'), ('ČK', 'ČK'), ('DA', 'DA'), ('DE', 'DE'), ('DJ', 'DJ'), ('DU', 'DU'), ('GS', 'GS'), ('IM', 'IM'), ('KA', 'KA'), ('KC', 'KC'), ('KR', 'KR'), ('KT', 'KT'), ('KŽ', 'KŽ'), ('MA', 'MA'), ('NA', 'NA'), ('NG', 'NG'), ('OG', 'OG'), ('OS', 'OS'), ('PU', 'PU'), ('PŽ', 'PŽ'), ('RI', 'RI'), ('SB', 'SB'), ('SK', 'SK'), ('SL', 'SL'), ('ST', 'ST'), ('ŠI', 'ŠI'), ('VK', 'VK'), ('VT', 'VT'), ('VU', 'VU'), ('VŽ', 'VŽ'), ('ZD', 'ZD'), ('ZG', 'ZG'), ('ŽU', 'ŽU'))

Only common license plate prefixes are provided. Special cases and obsolete prefixes are omitted. http://hr.wikipedia.org/wiki/Dodatak:Popis_registracijskih_oznaka_za_cestovna_vozila_u_Hrvatskoj

Hungary (hu)

Forms

HU-specific Form helpers

class localflavor.hu.forms.HUCountySelect(attrs=None)[source]

A Select widget that uses a list of Hungarian Counties as its choices.

New in version 1.3.

Data

localflavor.hu.hu_counties.HU_COUNTY_CHOICES = (('bacs_kiskun', 'Bács-Kiskun'), ('baranya', 'Baranya'), ('bekes', 'Békés'), ('borsod_abauj_zemplen', 'Borsod-Abaúj-Zemplén'), ('csongrad', 'Csongrád'), ('fejer', 'Fejér'), ('gyor_moson_sopron', 'Győr-Moson-Sopron'), ('hajdu_bihar', 'Hajdú-Bihar'), ('heves', 'Heves'), ('jasz_nagykun_szolnok', 'Jász-Nagykun-Szolnok'), ('komarom_esztergom', 'Komárom-Esztergom'), ('nograd', 'Nógrád'), ('pest', 'Pest'), ('somogy', 'Somogy'), ('szabolcs_szatmar_bereg', 'Szabolcs-Szatmár-Bereg'), ('tolna', 'Tolna'), ('vas', 'Vas'), ('veszprem', 'Veszprém'), ('zala', 'Zala'))

Hungarian counties: https://en.wikipedia.org/wiki/Counties_of_Hungary

Indonesia (id)

Forms

ID-specific Form helpers.

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

An Indonesian vehicle license plate field.

http://id.wikipedia.org/wiki/Tanda_Nomor_Kendaraan_Bermotor

Plus: “B 12345 12”

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.id_.forms.IDLicensePlatePrefixSelect(attrs=None)[source]

A Select widget that uses a list of vehicle license plate prefix code of Indonesia as its choices.

http://id.wikipedia.org/wiki/Tanda_Nomor_Kendaraan_Bermotor

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

An Indonesian national identity number (NIK/KTP#) field.

http://id.wikipedia.org/wiki/Nomor_Induk_Kependudukan

xx.xxxx.ddmmyy.xxxx - 16 digits (excl. dots) notes: for women dd + 40

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

An Indonesian post code field.

http://id.wikipedia.org/wiki/Kode_pos

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.id_.forms.IDProvinceSelect(attrs=None)[source]

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

Data

localflavor.id_.id_choices.PROVINCE_CHOICES = (('ACE', 'Aceh'), ('BLI', 'Bali'), ('BTN', 'Banten'), ('BKL', 'Bengkulu'), ('DIY', 'Yogyakarta'), ('JKT', 'Jakarta'), ('GOR', 'Gorontalo'), ('JMB', 'Jambi'), ('JBR', 'Jawa Barat'), ('JTG', 'Jawa Tengah'), ('JTM', 'Jawa Timur'), ('KBR', 'Kalimantan Barat'), ('KSL', 'Kalimantan Selatan'), ('KTG', 'Kalimantan Tengah'), ('KTM', 'Kalimantan Timur'), ('KTR', 'Kalimantan Utara'), ('BBL', 'Kepulauan Bangka-Belitung'), ('KRI', 'Kepulauan Riau'), ('LPG', 'Lampung'), ('MLK', 'Maluku'), ('MUT', 'Maluku Utara'), ('NTB', 'Nusa Tenggara Barat'), ('NTT', 'Nusa Tenggara Timur'), ('PPA', 'Papua'), ('PPB', 'Papua Barat'), ('RIU', 'Riau'), ('SLB', 'Sulawesi Barat'), ('SLS', 'Sulawesi Selatan'), ('SLT', 'Sulawesi Tengah'), ('SLR', 'Sulawesi Tenggara'), ('SLU', 'Sulawesi Utara'), ('SMB', 'Sumatera Barat'), ('SMS', 'Sumatera Selatan'), ('SMU', 'Sumatera Utara'))

Indonesia does not have an official Province code standard. I decided to use unambiguous and consistent (some are common) 3-letter codes. http://id.wikipedia.org/wiki/Daftar_provinsi_Indonesia

localflavor.id_.id_choices.LICENSE_PLATE_PREFIX_CHOICES = (('A', 'Banten'), ('AA', 'Magelang'), ('AB', 'Yogyakarta'), ('AD', 'Surakarta - Solo'), ('AE', 'Madiun'), ('AG', 'Kediri'), ('B', 'Jakarta'), ('BA', 'Sumatera Barat'), ('BB', 'Tapanuli'), ('BD', 'Bengkulu'), ('BE', 'Lampung'), ('BG', 'Sumatera Selatan'), ('BH', 'Jambi'), ('BK', 'Sumatera Utara'), ('BL', 'Nanggroe Aceh Darussalam'), ('BM', 'Riau'), ('BN', 'Kepulauan Bangka Belitung'), ('BP', 'Kepulauan Riau'), ('CC', 'Corps Consulate'), ('CD', 'Corps Diplomatic'), ('D', 'Bandung'), ('DA', 'Kalimantan Selatan'), ('DB', 'Sulawesi Utara Daratan'), ('DC', 'Sulawesi Barat'), ('DD', 'Sulawesi Selatan'), ('DE', 'Maluku'), ('DG', 'Maluku Utara'), ('DH', 'NTT - Timor'), ('DK', 'Bali'), ('DL', 'Sulawesi Utara Kepulauan'), ('DM', 'Gorontalo'), ('DN', 'Sulawesi Tengah'), ('DR', 'NTB - Lombok'), ('DS', 'Papua dan Papua Barat'), ('DT', 'Sulawesi Tenggara'), ('E', 'Cirebon'), ('EA', 'NTB - Sumbawa'), ('EB', 'NTT - Flores'), ('ED', 'NTT - Sumba'), ('F', 'Bogor'), ('G', 'Pekalongan'), ('H', 'Semarang'), ('K', 'Pati'), ('KB', 'Kalimantan Barat'), ('KH', 'Kalimantan Tengah'), ('KT', 'Kalimantan Timur'), ('L', 'Surabaya'), ('M', 'Madura'), ('N', 'Malang'), ('P', 'Jember'), ('R', 'Banyumas'), ('RI', 'Federal Government'), ('S', 'Bojonegoro'), ('T', 'Purwakarta'), ('W', 'Sidoarjo'), ('Z', 'Garut'))

License plate prefixes

Ireland (ie)

Forms

IE-specific Form helpers.

class localflavor.ie.forms.EircodeField(**kwargs)[source]

A form field that validates its input is a valid Eircode (Irish postcode).

The value is uppercased and has the internal space removed, if any.

See page 12 for the validation syntax: https://www.eircode.ie/docs/default-source/Common/prepareyourbusinessforeircode-edition3published.pdf?sfvrsn=2

New in version 2.2.

to_python(value)[source]

Return a string.

class localflavor.ie.forms.IECountySelect(attrs=None)[source]

A Select widget that uses a list of Irish Counties as its choices.

Data

localflavor.ie.ie_counties.IE_COUNTY_CHOICES = (('carlow', 'Carlow'), ('cavan', 'Cavan'), ('clare', 'Clare'), ('cork', 'Cork'), ('donegal', 'Donegal'), ('dublin', 'Dublin'), ('galway', 'Galway'), ('kerry', 'Kerry'), ('kildare', 'Kildare'), ('kilkenny', 'Kilkenny'), ('laois', 'Laois'), ('leitrim', 'Leitrim'), ('limerick', 'Limerick'), ('longford', 'Longford'), ('louth', 'Louth'), ('mayo', 'Mayo'), ('meath', 'Meath'), ('monaghan', 'Monaghan'), ('offaly', 'Offaly'), ('roscommon', 'Roscommon'), ('sligo', 'Sligo'), ('tipperary', 'Tipperary'), ('waterford', 'Waterford'), ('westmeath', 'Westmeath'), ('wexford', 'Wexford'), ('wicklow', 'Wicklow'))

Irish Counties: http://en.wikipedia.org/wiki/Counties_of_Ireland

Israel (il)

Forms

Israeli-specific form helpers.

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

A form field that validates its input as an Israeli identification number.

Valid form is per the Israeli ID specification.

Israeli ID numbers consist of up to 8 digits followed by a checksum digit. Numbers which are shorter than 8 digits are effectively left-zero-padded. The checksum digit is occasionally separated from the number by a hyphen, and is calculated using the luhn algorithm.

Relevant references (in Hewbrew):

http://he.wikipedia.org/wiki/%D7%9E%D7%A1%D7%A4%D7%A8_%D7%96%D7%94%D7%95%D7%AA_(%D7%99%D7%A9%D7%A8%D7%90%D7%9C) http://he.wikipedia.org/wiki/%D7%A1%D7%A4%D7%A8%D7%AA_%D7%91%D7%99%D7%A7%D7%95%D7%A8%D7%AA http://he.wikipedia.org/wiki/%D7%A7%D7%99%D7%93%D7%95%D7%9E%D7%AA_%D7%98%D7%9C%D7%A4%D7%95%D7%9F_%D7%91%D7%99%D7%A9%D7%A8%D7%90%D7%9C#.D7.A7.D7.99.D7.93.D7.95.D7.9E.D7.95.D7.AA_.D7.91.D7.99.D7.A9.D7.A8.D7.90.D7.9C_.D7.9C.D7.A4.D7.99_.D7.9E.D7.A4.D7.A2.D7.99.D7.9C.D7.99.D7.9D_.D7.95.D7.97.D7.9C.D7.95.D7.A7.D7.94_.D7.92.D7.90.D7.95.D7.92.D7.A8.D7.A4.D7.99.D7.AA

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.il.forms.ILPostalCodeField(**kwargs)[source]

A form field that validates its input as an Israeli postal code.

Valid form is XXXXX where X represents integer.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

India (in)

Forms

India-specific Form helpers.

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

A form field for Aadhaar number issued by Unique Identification Authority of India (UIDAI).

Checks the following rules to determine whether the number is valid:

  • Conforms to the XXXX XXXX XXXX format.
  • No group consists entirely of zeroes.

Important information:

  • Aadhaar number is a proof of identity but not of citizenship.
  • Aadhaar number is issued to every resident of India including foreign citizens.
  • Aadhaar number is not mandatory.

More information can be found at http://uidai.gov.in/what-is-aadhaar-number.html

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.in_.forms.INPANCardNumberFormField(**kwargs)[source]

A form field that accepts Indian Permanent account number(PAN) Card Number.

Rules:
  1. It should be ten characters long.
  2. The first three characters must be any upper case alphabets.
  3. The fourth character of PAN must be one of the following characters.
    A — Association of persons (AOP) B — Body of individuals (BOI) C — Company F — Firm G — Government H — HUF (Hindu undivided family) L — Local authority J — Artificial juridical person P — Person (Individual) T — Trust (AOP)
  4. The fifth character is first letter of lastname of the PAN Card holder in case of Individual
    or the first letter of first name in case of non-individual.
  5. The next four-characters must be any number from 0000 to 9999.
  6. The last(tenth) character which is a check-sum character must be any upper case alphabet.
Note:
  1. The validation of the fifth character must be done by the developer themselves,
    as this validation is out of the scope of this project.
  2. The validation for the last digit (i.e check-sum character) is not available
    in public domain, hence it is not implemented.
More Information at:
  1. https://en.wikipedia.org/wiki/Permanent_account_number
  2. https://www.incometaxindia.gov.in/tutorials/1.permanent%20account%20number%20(pan).pdf

New in version 4.0.

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

A form field that validates its input is a Indian state name or abbreviation.

It normalizes the input to the standard two-letter vehicle registration abbreviation for the given state or union territory

Changed in version 1.1: Added Telangana to list of states. More details at https://en.wikipedia.org/wiki/Telangana#Bifurcation_of_Andhra_Pradesh

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.in_.forms.INStateSelect(attrs=None)[source]

A Select widget that uses a list of Indian states/territories as its choices.

Changed in version 1.1: Added Telangana to list of states. More details at https://en.wikipedia.org/wiki/Telangana#Bifurcation_of_Andhra_Pradesh

Changed in version 3.1: Updated Indian states and union territories names and code as per iso 3166 (https://www.iso.org/obp/ui/#iso:code:3166:IN)

class localflavor.in_.forms.INZipCodeField(**kwargs)[source]

A form field that validates input as an Indian zip code, with the format XXXXXXX.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Data

localflavor.in_.in_states.STATE_CHOICES = (('KA', 'Karnataka'), ('AP', 'Andhra Pradesh'), ('KL', 'Kerala'), ('TN', 'Tamil Nadu'), ('MH', 'Maharashtra'), ('UP', 'Uttar Pradesh'), ('GA', 'Goa'), ('GJ', 'Gujarat'), ('RJ', 'Rajasthan'), ('HP', 'Himachal Pradesh'), ('TG', 'Telangana'), ('AR', 'Arunachal Pradesh'), ('AS', 'Assam'), ('BR', 'Bihar'), ('CT', 'Chhattisgarh'), ('HR', 'Haryana'), ('JH', 'Jharkhand'), ('MP', 'Madhya Pradesh'), ('MN', 'Manipur'), ('ML', 'Meghalaya'), ('MZ', 'Mizoram'), ('NL', 'Nagaland'), ('OR', 'Odisha'), ('PB', 'Punjab'), ('SK', 'Sikkim'), ('TR', 'Tripura'), ('UT', 'Uttarakhand'), ('WB', 'West Bengal'), ('AN', 'Andaman and Nicobar Islands'), ('CH', 'Chandigarh'), ('DH', 'Dadra and Nagar Haveli and Daman and Diu'), ('DL', 'Delhi'), ('JK', 'Jammu and Kashmir'), ('LD', 'Lakshadweep'), ('LA', 'Ladakh'), ('PY', 'Puducherry'))

A list of states

localflavor.in_.in_states.STATES_NORMALIZED = {'an': 'AN', 'andaman and nicobar': 'AN', 'andhra pradesh': 'AP', 'andhrapradesh': 'AP', 'andra pradesh': 'AP', 'andrapradesh': 'AP', 'ap': 'AP', 'ar': 'AR', 'arunachal pradesh': 'AR', 'as': 'AS', 'assam': 'AS', 'bengal': 'WB', 'bihar': 'BR', 'br': 'BR', 'cg': 'CG', 'ch': 'CH', 'chandigarh': 'CH', 'chhattisgarh': 'CG', 'dadra and nagar haveli': 'DN', 'daman and diu': 'DD', 'dd': 'DD', 'delhi': 'DL', 'dl': 'DL', 'dn': 'DN', 'ga': 'GA', 'gj': 'GJ', 'goa': 'GA', 'gujarat': 'GJ', 'haryana': 'HR', 'himachal pradesh': 'HP', 'hp': 'HP', 'hr': 'HR', 'jammu and kashmir': 'JK', 'jh': 'JH', 'jharkhand': 'JH', 'jk': 'JK', 'ka': 'KA', 'karnataka': 'KA', 'karnatka': 'KA', 'kerala': 'KL', 'kl': 'KL', 'lakshadweep': 'LD', 'ld': 'LD', 'madhya pradesh': 'MP', 'maharashtra': 'MH', 'maharastra': 'MH', 'manipur': 'MN', 'meghalaya': 'ML', 'mh': 'MH', 'mizo': 'MZ', 'mizoram': 'MZ', 'ml': 'ML', 'mn': 'MN', 'mp': 'MP', 'mz': 'MZ', 'nagaland': 'NL', 'nl': 'NL', 'odisa': 'OR', 'or': 'OR', 'orisa': 'OR', 'orissa': 'OR', 'pb': 'PB', 'pondicherry': 'PY', 'punjab': 'PB', 'py': 'PY', 'rajastan': 'RJ', 'rajasthan': 'RJ', 'rj': 'RJ', 'sikkim': 'SK', 'sk': 'SK', 'tamil nadu': 'TN', 'tamilnad': 'TN', 'tamilnadu': 'TN', 'telangana': 'TG', 'tg': 'TG', 'tn': 'TN', 'tr': 'TR', 'tripura': 'TR', 'ua': 'UA', 'up': 'UP', 'uttar pradesh': 'UP', 'uttarakhand': 'UA', 'wb': 'WB', 'west bengal': 'WB', 'westbengal': 'WB'}

Normalized state names

Iran (ir)

Forms

Iranian-specific form helpers.

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

A form field that validates its input as an Iranian identification number.

Valid form is per the Iranian ID specification.

Persian documentation :

http://www.aliarash.com/article/codemeli/codemeli.htm

There isn’t good English documentation available for the Iranian identification number. Non-Persian speakers will need to use an online translation service to read this documentation.

New in version 2.2.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.ir.forms.IRPostalCodeField(**kwargs)[source]

A form field that validates its input as an Iran postal code.

Valid form is XXXXXXXXXX where X represents integer.

Validate code:
  • don’t use 0 in first 5 digit
  • don’t use 2 in postal code
  • First 4 digit is not the same
  • The 5th digit cannot be 5
  • all digits aren’t the same

New in version 2.2.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.ir.forms.IRProvinceSelect(attrs=None)[source]

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

New in version 2.2.

localflavor.ir.ir_provinces.PROVINCE_CHOICES = (('AL', 'Alborz'), ('AR', 'Ardabil'), ('AE', 'Azerbaijan East'), ('AW', 'Azerbaijan Wast'), ('BU', 'Bushehr'), ('CM', 'Chahar Mahaal and Bakhtiari'), ('FA', 'Fars'), ('GI', 'Gilan'), ('GO', 'Golestan'), ('HA', 'Hamadan'), ('HO', 'Hormozgan'), ('IL', 'Ilam'), ('IS', 'Isfahan'), ('KE', 'Kerman'), ('KM', 'Kermanshah'), ('KN', 'Khorasan North'), ('KR', 'Khorasan Razavi'), ('KS', 'Khorasan South'), ('KH', 'Khuzestan'), ('KB', 'Kohgiluyeh and Boyer-Ahmad'), ('KU', 'Kurdistan'), ('LO', 'Lorestan'), ('MA', 'Markazi'), ('MZ', 'Mazandaran'), ('QA', 'Qazvin'), ('QO', 'Qom'), ('SE', 'Semnan'), ('SB', 'Sistan and Baluchestan'), ('TH', 'Tehran'), ('YZ', 'Yazd'), ('ZN', 'Zanjan'))

A list of Iran provinces and autonomous cities as choices in a formfield. From https://en.wikipedia.org/wiki/Provinces_of_Iran

Iceland (is)

Forms

Iceland specific form helpers.

class localflavor.is_.forms.ISIdNumberField(max_length=11, min_length=10, **kwargs)[source]

Icelandic identification number (kennitala).

This is a number every citizen of Iceland has.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.is_.forms.ISPostalCodeSelect(attrs=None)[source]

A Select widget that uses a list of Icelandic postal codes as its choices.

Data

localflavor.is_.is_postalcodes.IS_POSTALCODES = (('101', '101 Reykjavík'), ('102', '102 Reykjavík'), ('103', '103 Reykjavík'), ('104', '104 Reykjavík'), ('105', '105 Reykjavík'), ('107', '107 Reykjavík'), ('108', '108 Reykjavík'), ('109', '109 Reykjavík'), ('110', '110 Reykjavík'), ('111', '111 Reykjavík'), ('112', '112 Reykjavík'), ('113', '113 Reykjavík'), ('116', '116 Reykjavík'), ('121', '121 Reykjavík'), ('123', '123 Reykjavík'), ('124', '124 Reykjavík'), ('125', '125 Reykjavík'), ('127', '127 Reykjavík'), ('128', '128 Reykjavík'), ('129', '129 Reykjavík'), ('130', '130 Reykjavík'), ('132', '132 Reykjavík'), ('161', '161 Reykjavík'), ('162', '162 Reykjavík - Dreifbýli'), ('170', '170 Seltjarnarnesi'), ('172', '172 Seltjarnarnesi'), ('190', '190 Vogum'), ('191', '191 Vogum'), ('200', '200 Kópavogi'), ('201', '201 Kópavogi'), ('202', '202 Kópavogi'), ('203', '203 Kópavogi'), ('206', '206 Kópavogur'), ('210', '210 Garðabæ'), ('212', '212 Garðabæ'), ('220', '220 Hafnarfirði'), ('221', '221 Hafnarfirði'), ('222', '222 Hafnarfirði'), ('225', '225 Garðabæ'), ('230', '230 Reykjanesbæ'), ('232', '232 Reykjanesbæ'), ('233', '233 Reykjanesbæ'), ('235', '235 Keflavíkurflugvöllur'), ('240', '240 Grindavík'), ('241', '241 Grindavík'), ('245', '245 Suðurnesjabæ'), ('246', '246 Suðurnesjabæ'), ('250', '250 Suðurnesjabæ'), ('251', '251 Suðurnesjabæ'), ('260', '260 Reykjanesbæ'), ('262', '262 Reykjanesbæ'), ('270', '270 Mosfellsbæ'), ('271', '271 Mosfellsbæ'), ('276', '276 Mosfellsbæ'), ('300', '300 Akranesi'), ('301', '301 Akranesi'), ('302', '302 Akranesi'), ('310', '310 Borgarnesi'), ('311', '311 Borgarnesi'), ('320', '320 Reykholt í Borgarfirði'), ('340', '340 Stykkishólmi'), ('341', '341 Stykkishólmi'), ('342', '342 Stykkishólmur'), ('345', '345 Flatey á Breiðafirði'), ('350', '350 Grundarfirði'), ('351', '351 Grundarfirði'), ('355', '355 Ólafsvík'), ('356', '356 Snæfellsbæ'), ('360', '360 Hellissandi'), ('370', '370 Búðardal'), ('371', '371 Búðardal'), ('380', '380 Reykhólahreppi'), ('381', '381 Reykhólahreppi'), ('400', '400 Ísafirði'), ('401', '401 Ísafirði'), ('410', '410 Hnífsdal'), ('415', '415 Bolungarvík'), ('416', '416 Bolungarvík'), ('420', '420 Súðavík'), ('421', '421 Súðavík'), ('425', '425 Flateyri'), ('426', '426 Flateyri'), ('430', '430 Suðureyri'), ('431', '431 Suðureyri'), ('450', '450 Patreksfirði'), ('451', '451 Patreksfirði'), ('460', '460 Tálknafirði'), ('461', '461 Tálknafirði'), ('465', '465 Bíldudal'), ('466', '466 Bíldudal'), ('470', '470 Þingeyri'), ('471', '471 Þingeyri'), ('500', '500 Stað'), ('510', '510 Hólmavík'), ('511', '511 Hólmavík'), ('512', '512 Hólmavík'), ('520', '520 Drangsnesi'), ('524', '524 Árneshreppi'), ('530', '530 Hvammstanga'), ('531', '531 Hvammstanga'), ('540', '540 Blönduósi'), ('541', '541 Blönduósi'), ('545', '545 Skagaströnd'), ('546', '546 Skagaströnd'), ('550', '550 Sauðárkróki'), ('551', '551 Sauðárkróki'), ('560', '560 Varmahlíð'), ('561', '561 Varmahlíð'), ('565', '565 Hofsós'), ('566', '566 Hofsós'), ('570', '570 Fljótum'), ('580', '580 Siglufirði'), ('581', '581 Siglufirði'), ('600', '600 Akureyri'), ('601', '601 Akureyri'), ('602', '602 Akureyri'), ('603', '603 Akureyri'), ('604', '604 Akureyri'), ('605', '605 Akureyri'), ('606', '606 Akureyri'), ('607', '607 Akureyri'), ('610', '610 Grenivík'), ('611', '611 Grímsey'), ('616', '616 Grenivík'), ('620', '620 Dalvík'), ('621', '621 Dalvík'), ('625', '625 Ólafsfirði'), ('626', '626 Ólafsfirði'), ('630', '630 Hrísey'), ('640', '640 Húsavík'), ('641', '641 Húsavík'), ('645', '645 Fosshólli'), ('650', '650 Laugum'), ('660', '660 Mývatni'), ('670', '670 Kópaskeri'), ('671', '671 Kópaskeri'), ('675', '675 Raufarhöfn'), ('676', '676 Raufarhöfn'), ('680', '680 Þórshöfn'), ('681', '681 Þórshöfn'), ('685', '685 Bakkafirði'), ('686', '686 Bakkafirði'), ('690', '690 Vopnafirði'), ('691', '691 Vopnafirði'), ('700', '700 Egilsstöðum'), ('701', '701 Egilsstöðum'), ('710', '710 Seyðisfirði'), ('711', '711 Seyðisfirði'), ('715', '715 Mjóafirði'), ('720', '720 Borgarfirði (eystri)'), ('721', '721 Borgarfirði (eystri)'), ('730', '730 Reyðarfirði'), ('731', '731 Reyðarfirði'), ('735', '735 Eskifirði'), ('736', '736 Eskifirði'), ('740', '740 Neskaupstað'), ('741', '741 Neskaupsstað'), ('750', '750 Fáskrúðsfirði'), ('751', '751 Fáskrúðsfirði'), ('755', '755 Stöðvarfirði'), ('756', '756 Stöðvarfirði'), ('760', '760 Breiðdalsvík'), ('761', '761 Breiðdalsvík'), ('765', '765 Djúpavogi'), ('766', '766 Djúpavogi'), ('780', '780 Höfn í Hornafirði'), ('781', '781 Höfn í Hornafirði'), ('785', '785 Öræfum'), ('800', '800 Selfossi'), ('801', '801 Selfossi'), ('802', '802 Selfossi'), ('803', '803 Selfoss'), ('804', '804 Selfoss'), ('805', '805 Selfoss'), ('806', '806 Selfoss'), ('810', '810 Hveragerði'), ('815', '815 Þorlákshöfn'), ('816', '816 Ölfus'), ('820', '820 Eyrarbakka'), ('825', '825 Stokkseyri'), ('840', '840 Laugarvatni'), ('845', '845 Flúðum'), ('846', '846 Flúðum'), ('850', '850 Hellu'), ('851', '851 Hellu'), ('860', '860 Hvolsvelli'), ('861', '861 Hvolsvelli'), ('870', '870 Vík'), ('871', '871 Vík'), ('880', '880 Kirkjubæjarklaustri'), ('881', '881 Kirkjubæjarklaustri'), ('900', '900 Vestmannaeyjum'), ('902', '902 Vestmannaeyjum'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Italy (it)

Forms

IT-specific Form helpers.

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(**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).

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

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

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

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

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'), ('NU', 'Nuoro'), ('OR', 'Oristano'), ('SS', 'Sassari'), ('SU', 'Sud Sardegna'))), ('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.

Japan (jp)

Forms

JP-specific Form helpers.

class localflavor.jp.forms.JPPostalCodeField(**kwargs)[source]

A form field that validates its input is a Japanese postcode.

Accepts 7 digits, with or without a hyphen.

clean(value)[source]

Validates the input and returns a string that contains only numbers.

class localflavor.jp.forms.JPPrefectureCodeSelect(attrs=None)[source]

A Select widget for Japanese prefecture codes.

It uses a list of Japanese prefectures as its choices and the prefectures code as the post value.

class localflavor.jp.forms.JPPrefectureSelect(attrs=None)[source]

A Select widget that uses a list of Japanese prefectures as its choices.

Data

localflavor.jp.jp_prefectures.JP_PREFECTURES = (('hokkaido', 'Hokkaido'), ('aomori', 'Aomori'), ('iwate', 'Iwate'), ('miyagi', 'Miyagi'), ('akita', 'Akita'), ('yamagata', 'Yamagata'), ('fukushima', 'Fukushima'), ('ibaraki', 'Ibaraki'), ('tochigi', 'Tochigi'), ('gunma', 'Gunma'), ('saitama', 'Saitama'), ('chiba', 'Chiba'), ('tokyo', 'Tokyo'), ('kanagawa', 'Kanagawa'), ('niigata', 'Niigata'), ('toyama', 'Toyama'), ('ishikawa', 'Ishikawa'), ('fukui', 'Fukui'), ('yamanashi', 'Yamanashi'), ('nagano', 'Nagano'), ('gifu', 'Gifu'), ('shizuoka', 'Shizuoka'), ('aichi', 'Aichi'), ('mie', 'Mie'), ('shiga', 'Shiga'), ('kyoto', 'Kyoto'), ('osaka', 'Osaka'), ('hyogo', 'Hyogo'), ('nara', 'Nara'), ('wakayama', 'Wakayama'), ('tottori', 'Tottori'), ('shimane', 'Shimane'), ('okayama', 'Okayama'), ('hiroshima', 'Hiroshima'), ('yamaguchi', 'Yamaguchi'), ('tokushima', 'Tokushima'), ('kagawa', 'Kagawa'), ('ehime', 'Ehime'), ('kochi', 'Kochi'), ('fukuoka', 'Fukuoka'), ('saga', 'Saga'), ('nagasaki', 'Nagasaki'), ('kumamoto', 'Kumamoto'), ('oita', 'Oita'), ('miyazaki', 'Miyazaki'), ('kagoshima', 'Kagoshima'), ('okinawa', 'Okinawa'))

A list of prefectures

Kuwait (kw)

Forms

Kuwait-specific Form helpers.

class localflavor.kw.forms.KWAreaSelect(attrs=None)[source]

A Select widget that uses a list of Kuwait areas as its choices.

New in version 1.6.

class localflavor.kw.forms.KWCivilIDNumberField(max_length=12, min_length=12, **kwargs)[source]

Kuwaiti Civil ID numbers are 12 digits, second to seventh digits represents the person’s birthdate.

Checks the following rules to determine the validity of the number:
  • The number consist of 12 digits.
  • The birthdate of the person is a valid date.
  • The calculated checksum equals to the last digit of the Civil ID.
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.kw.forms.KWGovernorateSelect(attrs=None)[source]

A Select widget that uses a list of Kuwait governorates as its choices.

Lithuania (lt)

Forms

class localflavor.lt.forms.LTCountySelect(attrs=None)[source]

A select field with the Lithuanian counties as choices

class localflavor.lt.forms.LTIDCodeField(**kwargs)[source]

A form field that validates as Lithuanian ID Code.

Checks:
  • Made of exactly 11 decimal numbers.
  • Checksum is correct.
  • ID contains valid date.
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

valid_date(value)[source]

Check if date in ID code is valid.

We won’t check for dates in future as it would become too restrictive.

class localflavor.lt.forms.LTMunicipalitySelect(attrs=None)[source]

A select field with the Lithuanian municipalities as choices

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

A form field that validates and normalizes Lithuanian postal codes.

Lithuanian postal codes in following forms accepted:
  • XXXXX
  • LT-XXXXX
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Data

localflavor.lt.lt_choices.COUNTY_CHOICES = (('alytus', 'Alytus'), ('kaunas', 'Kaunas'), ('klaipeda', 'Klaipėda'), ('marijampole', 'Marijampolė'), ('panevezys', 'Panevėžys'), ('siauliai', 'Šiauliai'), ('taurage', 'Tauragė'), ('telsiai', 'Telšiai'), ('utena', 'Utena'), ('vilnius', 'Vilnius'))

Alphabetically sorted list of Lithuanian counties.

localflavor.lt.lt_choices.MUNICIPALITY_CHOICES = (('akmene', 'Akmenė district'), ('alytus_c', 'Alytus city'), ('alytus', 'Alytus district'), ('anyksciai', 'Anykščiai district'), ('birstonas', 'Birštonas'), ('birzai', 'Biržai district'), ('druskininkai', 'Druskininkai'), ('elektrenai', 'Elektrėnai'), ('ignalina', 'Ignalina district'), ('jonava', 'Jonava district'), ('joniskis', 'Joniškis district'), ('jurbarkas', 'Jurbarkas district'), ('kaisiadorys', 'Kaišiadorys district'), ('kalvarija', 'Kalvarija'), ('kaunas_c', 'Kaunas city'), ('kaunas', 'Kaunas district'), ('kazluruda', 'Kazlų Rūda'), ('kedainiai', 'Kėdainiai district'), ('kelme', 'Kelmė district'), ('klaipeda_c', 'Klaipėda city'), ('klaipeda', 'Klaipėda district'), ('kretinga', 'Kretinga district'), ('kupiskis', 'Kupiškis district'), ('lazdijai', 'Lazdijai district'), ('marijampole', 'Marijampolė'), ('mazeikiai', 'Mažeikiai district'), ('moletai', 'Molėtai district'), ('neringa', 'Neringa'), ('pagegiai', 'Pagėgiai'), ('pakruojis', 'Pakruojis district'), ('palanga', 'Palanga city'), ('panevezys_c', 'Panevėžys city'), ('panevezys', 'Panevėžys district'), ('pasvalys', 'Pasvalys district'), ('plunge', 'Plungė district'), ('prienai', 'Prienai district'), ('radviliskis', 'Radviliškis district'), ('raseiniai', 'Raseiniai district'), ('rietavas', 'Rietavas'), ('rokiskis', 'Rokiškis district'), ('skuodas', 'Skuodas district'), ('sakiai', 'Šakiai district'), ('salcininkai', 'Šalčininkai district'), ('siauliai_c', 'Šiauliai city'), ('siauliai', 'Šiauliai district'), ('silale', 'Šilalė district'), ('silute', 'Šilutė district'), ('sirvintos', 'Širvintos district'), ('svencionys', 'Švenčionys district'), ('taurage', 'Tauragė district'), ('telsiai', 'Telšiai district'), ('trakai', 'Trakai district'), ('ukmerge', 'Ukmergė district'), ('utena', 'Utena district'), ('varena', 'Varėna district'), ('vilkaviskis', 'Vilkaviškis district'), ('vilnius_c', 'Vilnius city'), ('vilnius', 'Vilnius district'), ('visaginas', 'Visaginas'), ('zarasai', 'Zarasai district'))

Alphabetically sorted lists of Lithuanian municipalities.

Latvia (lv)

New in version 1.1.

Forms

class localflavor.lv.forms.LVMunicipalitySelect(attrs=None)[source]

A select field of Latvian municipalities.

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

A form field that validates input as a Latvian personal code.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

static lv_checksum(value)[source]

Takes a string of 10 digits as input, returns check digit.

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

A form field that validates and normalizes Latvian postal codes.

Latvian postal codes in following forms accepted:
  • XXXX
  • LV-XXXX
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Data

localflavor.lv.lv_choices.MUNICIPALITY_CHOICES = (('DGV', 'Daugavpils'), ('JEL', 'Jelgava'), ('JKB', 'Jēkabpils'), ('JUR', 'Jūrmala'), ('LPX', 'Liepāja'), ('REZ', 'Rēzekne'), ('RIX', 'Riga'), ('VMR', 'Valmiera'), ('VEN', 'Ventspils'), ('001', 'Aglona municipality'), ('002', 'Aizkraukle municipality'), ('003', 'Aizpute municipality'), ('004', 'Aknīste municipality'), ('005', 'Aloja municipality'), ('006', 'Alsunga municipality'), ('007', 'Alūksne municipality'), ('008', 'Amata municipality'), ('009', 'Ape municipality'), ('010', 'Auce municipality'), ('011', 'Ādaži municipality'), ('012', 'Babīte municipality'), ('013', 'Baldone municipality'), ('014', 'Baltinava municipality'), ('015', 'Balvi municipality'), ('016', 'Bauska municipality'), ('017', 'Beverīna municipality'), ('018', 'Brocēni municipality'), ('019', 'Burtnieki municipality'), ('020', 'Carnikava municipality'), ('021', 'Cesvaine municipality'), ('022', 'Cēsis municipality'), ('023', 'Cibla municipality'), ('024', 'Dagda municipality'), ('025', 'Daugavpils municipality'), ('026', 'Dobele municipality'), ('027', 'Dundaga municipality'), ('028', 'Durbe municipality'), ('029', 'Engure municipality'), ('030', 'Ērgļi municipality'), ('031', 'Garkalne municipality'), ('032', 'Grobiņa municipality'), ('033', 'Gulbene municipality'), ('034', 'Iecava municipality'), ('035', 'Ikšķile municipality'), ('036', 'Ilūkste municipality'), ('037', 'Inčukalns municipality'), ('038', 'Jaunjelgava municipality'), ('039', 'Jaunpiebalga municipality'), ('040', 'Jaunpils municipality'), ('041', 'Jelgava municipality'), ('042', 'Jēkabpils municipality'), ('043', 'Kandava municipality'), ('044', 'Kārsava municipality'), ('045', 'Kocēni municipality'), ('046', 'Koknese municipality'), ('047', 'Krāslava municipality'), ('048', 'Krimulda municipality'), ('049', 'Krustpils municipality'), ('050', 'Kuldīga municipality'), ('051', 'Ķegums municipality'), ('052', 'Ķekava municipality'), ('053', 'Lielvārde municipality'), ('054', 'Limbaži municipality'), ('055', 'Līgatne municipality'), ('056', 'Līvāni municipality'), ('057', 'Lubāna municipality'), ('058', 'Ludza municipality'), ('059', 'Madona municipality'), ('060', 'Mazsalaca municipality'), ('061', 'Mālpils municipality'), ('062', 'Mārupe municipality'), ('063', 'Mērsrags municipality'), ('064', 'Naukšēni municipality'), ('065', 'Nereta municipality'), ('066', 'Nīca municipality'), ('067', 'Ogre municipality'), ('068', 'Olaine municipality'), ('069', 'Ozolnieki municipality'), ('070', 'Pārgauja municipality'), ('071', 'Pāvilosta municipality'), ('072', 'Pļaviņas municipality'), ('073', 'Preiļi municipality'), ('074', 'Priekule municipality'), ('075', 'Priekuļi municipality'), ('076', 'Rauna municipality'), ('077', 'Rēzekne municipality'), ('078', 'Riebiņi municipality'), ('079', 'Roja municipality'), ('080', 'Ropaži municipality'), ('081', 'Rucava municipality'), ('082', 'Rugāji municipality'), ('083', 'Rundāle municipality'), ('084', 'Rūjiena municipality'), ('085', 'Sala municipality'), ('086', 'Salacgrīva municipality'), ('087', 'Salaspils municipality'), ('088', 'Saldus municipality'), ('089', 'Saulkrasti municipality'), ('090', 'Sēja municipality'), ('091', 'Sigulda municipality'), ('092', 'Skrīveri municipality'), ('093', 'Skrunda municipality'), ('094', 'Smiltene municipality'), ('095', 'Stopiņi municipality'), ('096', 'Strenči municipality'), ('097', 'Talsi municipality'), ('098', 'Tērvete municipality'), ('099', 'Tukums municipality'), ('100', 'Vaiņode municipality'), ('101', 'Valka municipality'), ('102', 'Varakļāni municipality'), ('103', 'Vārkava municipality'), ('104', 'Vecpiebalga municipality'), ('105', 'Vecumnieki municipality'), ('106', 'Ventspils municipality'), ('107', 'Viesīte municipality'), ('108', 'Viļaka municipality'), ('109', 'Viļāni municipality'), ('110', 'Zilupe municipality'))

A list of Latvian municipalities and republican cities. Identifiers based on ISO 3166-2:LV. https://en.wikipedia.org/wiki/ISO_3166-2:LV

Moldova (md)

Forms

class localflavor.md.forms.MDCompanyTypesSelect(attrs=None)[source]

A Select widget that uses a list of Moldavian company types as its choices.

New in version 2.1.

class localflavor.md.forms.MDIDNOField(**kwargs)[source]

A form field for the Moldavian company identification number (IDNO).

New in version 2.1.

class localflavor.md.forms.MDLicensePlateField(**kwargs)[source]

A form field for the Moldavian license plate number.

New in version 2.1.

class localflavor.md.forms.MDRegionSelect(attrs=None)[source]

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

New in version 2.1.

Models

class localflavor.md.models.MDCompanyTypeField(*args, **kwargs)[source]

A model field for the Moldavian company type abbreviation.

New in version 2.1.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

class localflavor.md.models.MDIDNOField(*args, **kwargs)[source]

A model field for the Moldavian company identification number (IDNO).

New in version 2.1.

class localflavor.md.models.MDLicensePlateField(*args, **kwargs)[source]

A model field for the Moldavian license plate number.

New in version 2.1.

Validators

class localflavor.md.validators.MDIDNOFieldValidator(regex=None, message=None, code=None, inverse_match=None, flags=None)[source]

Validation for Moldavian IDNO.

New in version 2.1.

class localflavor.md.validators.MDLicensePlateValidator(regex=None, message=None, code=None, inverse_match=None, flags=None)[source]

Validation for Moldavian License Plates.

New in version 2.1.

Data

localflavor.md.choices.COMPANY_TYPES_CHOICES = (('II', 'Întreprindere Individuală'), ('SA', 'Societate pe acţiuni'), ('SNC', 'Societate în nume colectiv'), ('SC', 'Societatea în comandită'), ('CP', 'Cooperativa de producţie'), ('CI', 'Cooperativa de întreprinzători'), ('SRL', 'Societate cu răspundere limitată'), ('GT', 'Gospodăria ţărănească'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

localflavor.md.choices.LICENSE_PLATE_DIPLOMATIC = (('CD', 'Diplomatic Corps'), ('TS', 'Service Staff'), ('TC', 'Consular Staff'), ('CA', 'Administrative body'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

localflavor.md.choices.LICENSE_PLATE_GOVERNMENT_TYPE = (('P', 'Parliament'), ('G', 'Government'), ('A', 'Chancellery'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

localflavor.md.choices.LICENSE_PLATE_POLICE = (('MAI', 'Ministry of Internal Affairs'), ('MIC', 'Carabinieri Subdivision'), ('FA', 'Military Forces'), ('DG', 'Border Control'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Macedonia (mk)

Forms

class localflavor.mk.forms.MKIdentityCardNumberField(**kwargs)[source]

A Macedonian ID card number.

Accepts both old and new format.

class localflavor.mk.forms.MKMunicipalitySelect(attrs=None)[source]

A form Select widget that uses a list of Macedonian municipalities as choices.

The label is the name of the municipality and the value is a 2 character code for the municipality.

class localflavor.mk.forms.UMCNField(**kwargs)[source]

A form field that validates input as a unique master citizen number.

The format of the unique master citizen number has been kept the same from Yugoslavia. It is still in use in other countries as well, it is not applicable solely in Macedonia. For more information see: https://secure.wikimedia.org/wikipedia/en/wiki/Unique_Master_Citizen_Number

A value will pass validation if it complies to the following rules:

  • Consists of exactly 13 digits
  • The first 7 digits represent a valid past date in the format DDMMYYY
  • The last digit of the UMCN passes a checksum test
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Models

class localflavor.mk.models.MKIdentityCardNumberField(*args, **kwargs)[source]

A form field that validates input as a Macedonian identity card number.

Both old and new identity card numbers are supported.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.mk.models.MKMunicipalityField(*args, **kwargs)[source]

A form field that validates input as a Macedonian identity card number.

Both old and new identity card numbers are supported.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

class localflavor.mk.models.UMCNField(*args, **kwargs)[source]

A form field that validates input as a unique master citizen number.

The format of the unique master citizen number is not unique to Macedonia. For more information see: https://secure.wikimedia.org/wikipedia/en/wiki/Unique_Master_Citizen_Number

A value will pass validation if it complies to the following rules:

  • Consists of exactly 13 digits
  • The first 7 digits represent a valid past date in the format DDMMYYY
  • The last digit of the UMCN passes a checksum test
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

Data

localflavor.mk.mk_choices.MK_MUNICIPALITIES = (('AD', 'Aerodrom'), ('AR', 'Aračinovo'), ('BR', 'Berovo'), ('TL', 'Bitola'), ('BG', 'Bogdanci'), ('VJ', 'Bogovinje'), ('BS', 'Bosilovo'), ('BN', 'Brvenica'), ('BU', 'Butel'), ('VA', 'Valandovo'), ('VL', 'Vasilevo'), ('VV', 'Vevčani'), ('VE', 'Veles'), ('NI', 'Vinica'), ('VC', 'Vraneštica'), ('VH', 'Vrapčište'), ('GB', 'Gazi Baba'), ('GV', 'Gevgelija'), ('GT', 'Gostivar'), ('GR', 'Gradsko'), ('DB', 'Debar'), ('DA', 'Debarca'), ('DL', 'Delčevo'), ('DK', 'Demir Kapija'), ('DM', 'Demir Hisar'), ('DE', 'Dolneni'), ('DR', 'Drugovo'), ('GP', 'Gjorče Petrov'), ('ZE', 'Želino'), ('ZA', 'Zajas'), ('ZK', 'Zelenikovo'), ('ZR', 'Zrnovci'), ('IL', 'Ilinden'), ('JG', 'Jegunovce'), ('AV', 'Kavadarci'), ('KB', 'Karbinci'), ('KX', 'Karpoš'), ('VD', 'Kisela Voda'), ('KH', 'Kičevo'), ('KN', 'Konče'), ('OC', 'Koćani'), ('KY', 'Kratovo'), ('KZ', 'Kriva Palanka'), ('KG', 'Krivogaštani'), ('KS', 'Kruševo'), ('UM', 'Kumanovo'), ('LI', 'Lipkovo'), ('LO', 'Lozovo'), ('MR', 'Mavrovo i Rostuša'), ('MK', 'Makedonska Kamenica'), ('MD', 'Makedonski Brod'), ('MG', 'Mogila'), ('NG', 'Negotino'), ('NV', 'Novaci'), ('NS', 'Novo Selo'), ('OS', 'Oslomej'), ('OD', 'Ohrid'), ('PE', 'Petrovec'), ('PH', 'Pehčevo'), ('PN', 'Plasnica'), ('PP', 'Prilep'), ('PT', 'Probištip'), ('RV', 'Radoviš'), ('RN', 'Rankovce'), ('RE', 'Resen'), ('RO', 'Rosoman'), ('AJ', 'Saraj'), ('SL', 'Sveti Nikole'), ('SS', 'Sopište'), ('SD', 'Star Dojran'), ('NA', 'Staro Nagoričane'), ('UG', 'Struga'), ('RU', 'Strumica'), ('SU', 'Studeničani'), ('TR', 'Tearce'), ('ET', 'Tetovo'), ('CE', 'Centar'), ('CZ', 'Centar-Župa'), ('CI', 'Čair'), ('CA', 'Čaška'), ('CH', 'Češinovo-Obleševo'), ('CS', 'Čučer-Sandevo'), ('ST', 'Štip'), ('SO', 'Šuto Orizari'))

Macedonian municipalities per the reorganization from 2004.

Malta (mt)

New in version 1.1.

Forms

Maltese-specific Form helpers.

Mexico (mx)

Forms

Mexican-specific form helpers.

localflavor.mx.forms.CURP_INCONVENIENT_WORDS = ['BACA', 'BAKA', 'BUEI', 'BUEY', 'CACA', 'CACO', 'CAGA', 'CAGO', 'CAKA', 'CAKO', 'COGE', 'COGI', 'COJA', 'COJE', 'COJI', 'COJO', 'COLA', 'CULO', 'FALO', 'FETO', 'GETA', 'GUEI', 'GUEY', 'JETA', 'JOTO', 'KACA', 'KACO', 'KAGA', 'KAGO', 'KAKA', 'KAKO', 'KOGE', 'KOGI', 'KOJA', 'KOJE', 'KOJI', 'KOJO', 'KOLA', 'KULO', 'LILO', 'LOCA', 'LOCO', 'LOKA', 'LOKO', 'MAME', 'MAMO', 'MEAR', 'MEAS', 'MEON', 'MIAR', 'MION', 'MOCO', 'MOKO', 'MULA', 'MULO', 'NACA', 'NACO', 'PEDA', 'PEDO', 'PENE', 'PIPI', 'PITO', 'POPO', 'PUTA', 'PUTO', 'QULO', 'RATA', 'ROBA', 'ROBE', 'ROBO', 'RUIN', 'SENO', 'TETA', 'VAGA', 'VAGO', 'VAKA', 'VUEI', 'VUEY', 'WUEI', 'WUEY']

This is the list of inconvenient words according to the Anexo 2 of the document described in the next link: http://portal.veracruz.gob.mx/pls/portal/url/ITEM/444112558A57C6E0E040A8C02E00695C

class localflavor.mx.forms.MXCLABEField(min_length=18, max_length=18, **kwargs)[source]

This field validates a CLABE (Clave Bancaria Estandarizada).

A CLABE is a 18-digits long number. The first 6 digits denote bank and branch number. The remaining 12 digits denote an account number, plus a verifying digit.

More info: https://en.wikipedia.org/wiki/CLABE

New in version 1.4.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.mx.forms.MXCURPField(min_length=18, max_length=18, **kwargs)[source]

A field that validates a Mexican Clave Única de Registro de Población.

The CURP is integrated by a juxtaposition of characters following the next pattern:

Index Format Accepted Characters
1 X Any letter
2 X Any vowel
3-4 XX Any letter
5-10 YYMMDD Any valid date
11 X Either H or M, depending on the person’s gender
12-13 XX Any valid acronym for a state in Mexico
14-16 XXX Any consonant
17 X Any number between 0 and 9 or any letter
18 X Any number between 0 and 9
More info about this:
http://www.condusef.gob.mx/index.php/clave-unica-de-registro-de-poblacion-curp
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.mx.forms.MXRFCField(min_length=12, max_length=13, **kwargs)[source]

A form field that validates a Mexican Registro Federal de Contribuyentes.

Validates either Persona física or Persona moral. The Persona física RFC string is integrated by a juxtaposition of characters following the next pattern:

Index Format Accepted Characters
1 X Any letter
2 X Any vowel
3-4 XX Any letter
5-10 YYMMDD Any valid date
11-12 XX Any letter or number between 0 and 9
13 X Any digit between 0 and 9 or the letter A

The Persona moral RFC string is integrated by a juxtaposition of characters following the next pattern:

Index Format Accepted Characters
1-3 XXX Any letter including & and Ñ chars
4-9 YYMMDD Any valid date
10-11 XX Any letter or number between 0 and 9
12 X Any number between 0 and 9 or the letter A
More info about this:
http://es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico)
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.mx.forms.MXSocialSecurityNumberField(min_length=11, max_length=11, **kwargs)[source]

A field that validates a Mexican Social Security Number.

The Social Security Number is integrated by a juxtaposition of digits following the next pattern:

Index Required numbers
1-2 The number of the branch office where the Social Security Number was designated.
3-4 The year of inscription to the Social Security.
5-6 The year of birth of the Social Security Number owner.
7-10 The progressive number of procedure for the IMSS. (This digit is provided exclusively by the Institute as it regards the Folio number of such procedure).
11 The verification digit.
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.mx.forms.MXStateSelect(attrs=None)[source]

A Select widget that uses a list of Mexican states as its choices.

class localflavor.mx.forms.MXZipCodeField(**kwargs)[source]

A form field that accepts a Mexican Zip Code.

More info about this:
http://en.wikipedia.org/wiki/List_of_postal_codes_in_Mexico
localflavor.mx.forms.RFC_INCONVENIENT_WORDS = ['BUEI', 'BUEY', 'CACA', 'CACO', 'CAGA', 'CAGO', 'CAKA', 'CAKO', 'COGE', 'COJA', 'COJE', 'COJI', 'COJO', 'CULO', 'FETO', 'GUEY', 'JOTO', 'KACA', 'KACO', 'KAGA', 'KAGO', 'KOGE', 'KOJO', 'KAKA', 'KULO', 'MAME', 'MAMO', 'MEAR', 'MEAS', 'MEON', 'MION', 'MOCO', 'MULA', 'PEDA', 'PEDO', 'PENE', 'PUTA', 'PUTO', 'QULO', 'RATA', 'RUIN']

This is the list of inconvenient words according to the Anexo IV of the document described in the next link: http://www.sisi.org.mx/jspsi/documentos/2005/seguimiento/06101/0610100162005_065.doc

Models

class localflavor.mx.models.MXCLABEField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXCURPField field and stores the value of a valid Mexican CLABE.

New in version 1.4.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.mx.models.MXCURPField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXCURPField field and stores the value of a valid Mexican CURP.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.mx.models.MXRFCField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXRFCField field and stores the value of a valid Mexican RFC.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.mx.models.MXSocialSecurityNumberField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXSocialSecurityNumberField field.

It stores the value of a valid Mexican Social Security Number.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.mx.models.MXStateField(*args, **kwargs)[source]

A model field that stores the three or four letter Mexican state abbreviation in the database.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

class localflavor.mx.models.MXZipCodeField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXZipCodeField field and stores the five-digit Mexican zip code.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

Data

localflavor.mx.mx_states.STATE_CHOICES = (('AGU', 'Aguascalientes'), ('BCN', 'Baja California'), ('BCS', 'Baja California Sur'), ('CAM', 'Campeche'), ('CDMX', 'Ciudad de México'), ('CHH', 'Chihuahua'), ('CHP', 'Chiapas'), ('COA', 'Coahuila'), ('COL', 'Colima'), ('DUR', 'Durango'), ('GRO', 'Guerrero'), ('GUA', 'Guanajuato'), ('HID', 'Hidalgo'), ('JAL', 'Jalisco'), ('MEX', 'Estado de México'), ('MIC', 'Michoacán'), ('MOR', 'Morelos'), ('NAY', 'Nayarit'), ('NLE', 'Nuevo León'), ('OAX', 'Oaxaca'), ('PUE', 'Puebla'), ('QUE', 'Querétaro'), ('ROO', 'Quintana Roo'), ('SIN', 'Sinaloa'), ('SLP', 'San Luis Potosí'), ('SON', 'Sonora'), ('TAB', 'Tabasco'), ('TAM', 'Tamaulipas'), ('TLA', 'Tlaxcala'), ('VER', 'Veracruz'), ('YUC', 'Yucatán'), ('ZAC', 'Zacatecas'))

All 31 states, plus the Ciudad de México.

Malaysia (my)

Forms

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

A form field that validates input as a Malaysia MyKad number.

Conforms to the YYMMDD-PB-###G or YYMMDDPB###G format More info: https://en.wikipedia.org/wiki/Malaysian_identity_card

New in version 3.0.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

to_python(value)[source]

Return a string.

The Netherlands (nl)

Forms

NL-specific Form helpers.

class localflavor.nl.forms.NLBSNFormField(**kwargs)[source]

A Dutch social security number (BSN) field.

https://nl.wikipedia.org/wiki/Burgerservicenummer

Note that you may only process the BSN if you have a legal basis to do so!

New in version 1.6.

class localflavor.nl.forms.NLLicensePlateFormField(**kwargs)[source]

A Dutch license plate field.

https://www.rdw.nl/ https://nl.wikipedia.org/wiki/Nederlands_kenteken

New in version 2.1.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.nl.forms.NLProvinceSelect(attrs=None)[source]

A Select widget that uses a list of provinces of the Netherlands as it’s choices.

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

A Dutch zip code field.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Models

class localflavor.nl.models.NLBSNField(*args, **kwargs)[source]

A Dutch social security number (BSN).

This model field uses validators.NLBSNFieldValidator for validation.

New in version 1.6.

description = 'Dutch social security number (BSN)'
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

validators = [<localflavor.nl.validators.NLBSNFieldValidator object>]
class localflavor.nl.models.NLLicensePlateField(*args, **kwargs)[source]

A Dutch license plate.

This model field uses validators.NLLicensePlateFieldValidator for validation.

New in version 2.1.

default_form_field

alias of localflavor.nl.forms.NLLicensePlateFormField

description = 'Dutch license plate'
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

validators = [<localflavor.nl.validators.NLLicensePlateFieldValidator object>]
class localflavor.nl.models.NLProvinceField(*args, **kwargs)[source]

A Dutch Province field.

New in version 1.3.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

description = 'Dutch province'
class localflavor.nl.models.NLZipCodeField(*args, **kwargs)[source]

A Dutch zip code model field.

This model field uses validators.NLZipCodeFieldValidator for validation.

New in version 1.3.

description = 'Dutch zipcode'
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value)[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

validators = [<localflavor.nl.validators.NLZipCodeFieldValidator object>]

Data

localflavor.nl.nl_provinces.PROVINCE_CHOICES = (('DR', 'Drenthe'), ('FL', 'Flevoland'), ('FR', 'Fryslân'), ('GL', 'Gelderland'), ('GR', 'Groningen'), ('LB', 'Limburg'), ('NB', 'Noord-Brabant'), ('NH', 'Noord-Holland'), ('OV', 'Overijssel'), ('UT', 'Utrecht'), ('ZE', 'Zeeland'), ('ZH', 'Zuid-Holland'))

An alphabetical list of provinces

Norway (no)

Forms

Norwegian-specific Form helpers.

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

A form field for Norwegian bank account numbers.

Performs MOD11 with the custom weights for the Norwegian bank account numbers, including a check for a remainder of 0, in which event the checksum is also 0.

Usually their string representation is along the lines of ZZZZ.YY.XXXXX, where the last X is the check digit. They’re always a total of 11 digits long, with 10 out of these 11 being the actual account number itself.

  • Accepts, and strips, account numbers with extra spaces.
  • Accepts, and strips, account numbers provided in form of XXXX.YY.XXXXX.

Note

No consideration is taking for banking clearing numbers as of yet, seeing as these are only used between banks themselves.

New in version 1.5.

to_python(value)[source]

Return a string.

class localflavor.no.forms.NOMunicipalitySelect(attrs=None)[source]

A Select widget that uses a list of Norwegian municipalities (fylker) as its choices.

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

Algorithm is documented at http://no.wikipedia.org/wiki/Personnummer.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.no.forms.NOZipCodeField(**kwargs)[source]

A form field that validates input as a Norwegian zip code.

Valid codes have four digits.

Data

localflavor.no.no_municipalities.MUNICIPALITY_CHOICES = (('akershus', 'Akershus'), ('austagder', 'Aust-Agder'), ('buskerud', 'Buskerud'), ('finnmark', 'Finnmark'), ('hedmark', 'Hedmark'), ('hordaland', 'Hordaland'), ('janmayen', 'Jan Mayen'), ('moreogromsdal', 'Møre og Romsdal'), ('nordtrondelag', 'Nord-Trøndelag'), ('nordland', 'Nordland'), ('oppland', 'Oppland'), ('oslo', 'Oslo'), ('rogaland', 'Rogaland'), ('sognogfjordane', 'Sogn og Fjordane'), ('svalbard', 'Svalbard'), ('sortrondelag', 'Sør-Trøndelag'), ('telemark', 'Telemark'), ('troms', 'Troms'), ('vestagder', 'Vest-Agder'), ('vestfold', 'Vestfold'), ('ostfold', 'Østfold'))

An alphabetical list of Norwegian municipalities (fylker) for use as choices in a formfield.

Nepal (np)

Forms

Nepal specific form helpers.

class localflavor.np.forms.NPDistrictSelect(attrs=None)[source]

A Select widget with option to select a district from list of all districts of Nepal.

class localflavor.np.forms.NPPostalCodeFormField(**kwargs)[source]

A form field that accepts Nepali postal code. Format : XXXXX

Postal codes: https://en.wikipedia.org/wiki/List_of_postal_codes_in_Nepal

class localflavor.np.forms.NPProvinceSelect(attrs=None)[source]

A Select widget with option to select a province from list of all provinces of Nepal.

class localflavor.np.forms.NPZoneSelect(attrs=None)[source]

A Select widget with option to select a zone from list of all zones of Nepal.

Data

localflavor.np.np_provinces.PROVINCES = [('bagmati', 'Bagmati'), ('gandaki', 'Gandaki'), ('karnali', 'Karnali'), ('lumbini', 'Lumbini'), ('province1', 'Province 1'), ('province2', 'Province 2'), ('sudurpaschim', 'Sudurpaschim')]

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

localflavor.np.np_zones.ZONES = [('bagmati', 'Bagmati'), ('bheri', 'Bheri'), ('dhawalagiri', 'Dhawalagiri'), ('dandaki', 'Gandaki'), ('janakpur', 'Janakpur'), ('karnali', 'Karnali'), ('koshi', 'Koshi'), ('lumbini', 'Lumbini'), ('mahakali', 'Mahakali'), ('mechi', 'Mechi'), ('narayani', 'Narayani'), ('rapti', 'Rapti'), ('sagarmatha', 'Sagarmatha'), ('seti', 'Seti')]

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

localflavor.np.np_districts.DISTRICTS = [('achham', 'Achham'), ('arghakhanchi', 'Arghakhanchi'), ('baglung', 'Baglung'), ('baitadi', 'Baitadi'), ('bajhang', 'Bajhang'), ('bajura', 'Bajura'), ('banke', 'Banke'), ('bara', 'Bara'), ('bardiya', 'Bardiya'), ('bhaktapur', 'Bhaktapur'), ('bhojpur', 'Bhojpur'), ('chitwan', 'Chitwan'), ('dadeldhura', 'Dadeldhura'), ('dailekh', 'Dailekh'), ('dang_deukhuri', 'Dang Deukhuri'), ('darchula', 'Darchula'), ('dhading', 'Dhading'), ('dhankuta', 'Dhankuta'), ('dhanusa', 'Dhanusa'), ('dholkha', 'Dholkha'), ('dolpa', 'Dolpa'), ('doti', 'Doti'), ('gorkha', 'Gorkha'), ('gulmi', 'Gulmi'), ('humla', 'Humla'), ('ilam', 'Ilam'), ('jajarkot', 'Jajarkot'), ('jhapa', 'Jhapa'), ('jumla', 'Jumla'), ('kailali', 'Kailali'), ('kalikot', 'Kalikot'), ('kanchanpur', 'Kanchanpur'), ('kapilvastu', 'Kapilvastu'), ('kaski', 'Kaski'), ('kathmandu', 'Kathmandu'), ('kavrepalanchok', 'Kavrepalanchok'), ('khotang', 'Khotang'), ('lalitpur', 'Lalitpur'), ('lamjung', 'Lamjung'), ('mahottari', 'Mahottari'), ('makwanpur', 'Makwanpur'), ('manang', 'Manang'), ('morang', 'Morang'), ('mugu', 'Mugu'), ('mustang', 'Mustang'), ('myagdi', 'Myagdi'), ('nawalparasi', 'Nawalparasi'), ('nuwakot', 'Nuwakot'), ('okhaldhunga', 'Okhaldhunga'), ('palpa', 'Palpa'), ('panchthar', 'Panchthar'), ('parbat', 'Parbat'), ('parsa', 'Parsa'), ('pyuthan', 'Pyuthan'), ('ramechhap', 'Ramechhap'), ('rasuwa', 'Rasuwa'), ('rautahat', 'Rautahat'), ('rolpa', 'Rolpa'), ('rukum', 'Rukum'), ('rupandehi', 'Rupandehi'), ('salyan', 'Salyan'), ('sankhuwasabha', 'Sankhuwasabha'), ('saptari', 'Saptari'), ('sarlahi', 'Sarlahi'), ('sindhuli', 'Sindhuli'), ('sindhupalchok', 'Sindhupalchok'), ('siraha', 'Siraha'), ('solukhumbu', 'Solukhumbu'), ('sunsari', 'Sunsari'), ('surkhet', 'Surkhet'), ('syangja', 'Syangja'), ('tanahu', 'Tanahu'), ('taplejung', 'Taplejung'), ('terhathum', 'Terhathum'), ('udayapur', 'Udayapur')]

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

New Zealand (nz)

New in version 1.1.

Forms

New Zealand specific form helpers.

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

A form field that validates its input as New Zealand bank account number.

Formats:

XX-XXXX-XXXXXXX-XX

XX-XXXX-XXXXXXX-XXX

Where:

  • the first two digits is the bank ID
  • the next four digits are the branch number where the account was opened
  • the next 7 digits are the account numbers
  • the last two or three digits define type of the account.
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.nz.forms.NZNorthIslandCouncilSelect(attrs=None)[source]

A select widget with list of New Zealand North Island city and district councils as its choices.

class localflavor.nz.forms.NZPostCodeField(**kwargs)[source]

A form field that validates its input as New Zealand postal code.

class localflavor.nz.forms.NZProvinceSelect(attrs=None)[source]

A select widget with list of New Zealand provinces as its choices.

class localflavor.nz.forms.NZRegionSelect(attrs=None)[source]

A select widget with list of New Zealand regions as its choices.

class localflavor.nz.forms.NZSouthIslandCouncilSelect(attrs=None)[source]

A select widget with list of New Zealand South Island city and district councils as its choices.

Data

localflavor.nz.nz_regions.REGION_CHOICES = (('NZ-NTL', 'Northland'), ('NZ-AUK', 'Auckland'), ('NZ-WKO', 'Waikato'), ('NZ-BOP', 'Bay of Plenty'), ('NZ-GIS', 'Gisborne'), ('NZ-HKB', "Hawke's Bay"), ('NZ-TKI', 'Taranaki'), ('NZ-MWT', 'Manawatu-Wanganui'), ('NZ-WGN', 'Wellington'), ('NZ-TAS', 'Tasman'), ('NZ-NSN', 'Nelson'), ('NZ-MBH', 'Marlborough'), ('NZ-WTC', 'West Coast'), ('NZ-CAN', 'Canterbury'), ('NZ-OTA', 'Otago'), ('NZ-STL', 'Southland'))

A list of regions

localflavor.nz.nz_provinces.PROVINCE_CHOICES = (('Auckland', 'Auckland'), ('Taranaki', 'Taranaki'), ("Hawke's Bay", "Hawke's Bay"), ('Wellington', 'Wellington'), ('Marlborough', 'Marlborough'), ('Nelson', 'Nelson'), ('Canterbury', 'Canterbury'), ('South Canterbury', 'South Canterbury'), ('Westland', 'Westland'), ('Otago', 'Otago'), ('Southland', 'Southland'), ('Chatham Islands', 'Chatham Islands'))

A list of provinces (abolished in 1876, use regions instead)

localflavor.nz.nz_councils.NORTH_ISLAND_COUNCIL_CHOICES = (('Far North', 'Far North District'), ('Whangarei', 'Whangarei District'), ('Kaipara', 'Kaipara District'), ('Auckland', 'Auckland'), ('Thames-Coromandel', 'Thames-Coromandel District'), ('Hauraki', 'Hauraki District'), ('Waikato', 'Waikato District'), ('Matamata-Piako', 'Matamata-Piako District'), ('Hamilton', 'Hamilton'), ('Waipa', 'Waipa District'), ('South Waikato', 'South Waikato District'), ('Otorohanga', 'Otorohanga District'), ('Waitomo', 'Waitomo District'), ('Taupo', 'Taupo District'), ('Western Bay of Plenty', 'Western Bay of Plenty District'), ('Tauranga', 'Tauranga'), ('Opotiki', 'Opotiki District'), ('Whakatane', 'Whakatane District'), ('Rotorua\t', 'Rotorua District'), ('Kawerau', 'Kawerau District'), ('Gisborne', 'Gisborne District'), ('Wairoa', 'Wairoa District'), ('Hastings', 'Hastings District'), ('Napier', 'Napier'), ("Central Hawke's Bay", "Central Hawke's Bay District"), ('New Plymouth', 'New Plymouth District'), ('Stratford', 'Stratford District'), ('South Taranaki', 'South Taranaki District'), ('Ruapehu', 'Ruapehu District'), ('Rangitikei', 'Rangitikei District'), ('Wanganui', 'Wanganui District'), ('Manawatu', 'Manawatu District'), ('Palmerston North', 'Palmerston North'), ('Tararua', 'Tararua District'), ('Horowhenua', 'Horowhenua District'), ('Masterton', 'Masterton District'), ('Kapiti Coast', 'Kapiti Coast District'), ('Carterton', 'Carterton District'), ('South Wairarapa', 'South Wairarapa District'), ('Upper Hutt', 'Upper Hutt'), ('Porirua', 'Porirua'), ('Hutt', 'Hutt'), ('Wellington', 'Wellington'))

A list of North Island city and district councils

localflavor.nz.nz_councils.SOUTH_ISLAND_COUNCIL_CHOICES = (('Tasman', 'Tasman District'), ('Nelson', 'Nelson'), ('Marlborough', 'Marlborough District'), ('Buller', 'Buller District'), ('Grey', 'Grey District'), ('Westland', 'Westland District'), ('Kaikoura', 'Kaikoura District'), ('Hurunui', 'Hurunui District'), ('Selwyn', 'Selwyn District'), ('Waimakariri', 'Waimakariri District'), ('Christchurch', 'Christchurch'), ('Ashburton', 'Ashburton District'), ('Mackenzie', 'Mackenzie District'), ('Timaru', 'Timaru District'), ('Waimate', 'Waimate District'), ('Waitaki', 'Waitaki District'), ('Queenstown-Lakes', 'Queenstown-Lakes District'), ('Central Otago', 'Central Otago District'), ('Dunedin', 'Dunedin'), ('Clutha', 'Clutha District'), ('Southland', 'Southland District'), ('Gore', 'Gore District'), ('Invercargill', 'Invercargill'))

A list of South Island city and district councils

Peru (pe)

Forms

PE-specific Form helpers.

class localflavor.pe.forms.PEDNIField(max_length=8, min_length=8, **kwargs)[source]

A field that validates Documento Nacional de Identidad (DNI) numbers.

clean(value)[source]

Value must be a string in the XXXXXXXX formats.

class localflavor.pe.forms.PERUCField(max_length=11, min_length=11, **kwargs)[source]

This field validates a RUC (Registro Unico de Contribuyentes).

A RUC is of the form XXXXXXXXXXX.

clean(value)[source]

Value must be an 11-digit number.

class localflavor.pe.forms.PERegionSelect(attrs=None)[source]

A Select widget that uses a list of Peruvian Regions as its choices.

Data

localflavor.pe.pe_region.REGION_CHOICES = (('AMA', 'Amazonas'), ('ANC', 'Ancash'), ('APU', 'Apurímac'), ('ARE', 'Arequipa'), ('AYA', 'Ayacucho'), ('CAJ', 'Cajamarca'), ('CAL', 'Callao'), ('CUS', 'Cusco'), ('HUV', 'Huancavelica'), ('HUC', 'Huánuco'), ('ICA', 'Ica'), ('JUN', 'Junín'), ('LAL', 'La Libertad'), ('LAM', 'Lambayeque'), ('LIM', 'Lima'), ('LOR', 'Loreto'), ('MDD', 'Madre de Dios'), ('MOQ', 'Moquegua'), ('PAS', 'Pasco'), ('PIU', 'Piura'), ('PUN', 'Puno'), ('SAM', 'San Martín'), ('TAC', 'Tacna'), ('TUM', 'Tumbes'), ('UCA', 'Ucayali'))

A list of Peru regions as choices in a formfield.

Pakistan (pk)

Forms

Pakistani-specific Form helpers.

class localflavor.pk.forms.PKPostCodeField(**kwargs)[source]

Pakistani post code field.

Assumed to be 5 digits.

class localflavor.pk.forms.PKStateSelect(attrs=None)[source]

A Select widget that uses a list of Pakistani states/territories as its choices.

Models

class localflavor.pk.models.PKPostCodeField(*args, **kwargs)[source]

A model field that stores the five-digit Pakistani postcode in the database

Forms represent it as a PKPostCodeField field.

description = 'Pakistani Postcode'
formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.pk.models.PKStateField(*args, **kwargs)[source]

A model field that stores the five-letter Pakistani state abbreviation in the database.

It is represented with STATE_CHOICES` choices.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

description = 'Pakistani State'

Data

localflavor.pk.pk_states.STATE_CHOICES = (('PK-JK', 'Azad Jammu & Kashmir'), ('PK-BA', 'Balochistan'), ('PK-TA', 'Federally Administered Tribal Areas'), ('PK-GB', 'Gilgit-Baltistan'), ('PK-IS', 'Islamabad'), ('PK-KP', 'Khyber Pakhtunkhwa'), ('PK-PB', 'Punjab'), ('PK-SD', 'Sindh'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Poland (pl)

Forms

Polish-specific form helpers.

class localflavor.pl.forms.PLCountySelect(attrs=None)[source]

A select widget with list of Polish administrative units as choices.

class localflavor.pl.forms.PLNIPField(**kwargs)[source]

A form field that validates as Polish Tax Number (NIP).

Valid forms are: XXX-YYY-YY-YY, XXX-YY-YY-YYY or XXXYYYYYYY. Checksum algorithm based on documentation at http://wipos.p.lodz.pl/zylla/ut/nip-rego.html

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

has_valid_checksum(number)[source]

Calculates a checksum with the provided algorithm.

class localflavor.pl.forms.PLNationalIDCardNumberField(**kwargs)[source]

A form field that validates as Polish National ID Card Number.

Checks the following rules:
  • the length consist of 3 letter and 6 digits
  • has a valid checksum

The algorithm is documented at http://en.wikipedia.org/wiki/Polish_identity_card.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

has_valid_checksum(number)[source]

Calculates a checksum with the provided algorithm.

class localflavor.pl.forms.PLPESELField(**kwargs)[source]

A form field that validates as Polish Identification Number (PESEL).

Checks the following rules:
  • the length consist of 11 digits
  • has a valid checksum
  • contains a valid birth date

The algorithm is documented at http://en.wikipedia.org/wiki/PESEL.

Changed in version 1.4.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

has_valid_birth_date(number)[source]

Checks whether the birth date encoded in PESEL is valid.

has_valid_checksum(number)[source]

Calculates a checksum with the provided algorithm.

class localflavor.pl.forms.PLPostalCodeField(**kwargs)[source]

A form field that validates as Polish postal code.

Valid code is XX-XXX where X is digit.

class localflavor.pl.forms.PLProvinceSelect(attrs=None)[source]

A select widget with list of Polish administrative provinces as choices.

class localflavor.pl.forms.PLREGONField(**kwargs)[source]

A form field that validates its input is a REGON number.

Valid regon number consists of 9 or 14 digits. See http://www.stat.gov.pl/bip/regon_ENG_HTML.htm for more information.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

has_valid_checksum(number)[source]

Calculates a checksum with the provided algorithm.

Data

localflavor.pl.pl_administrativeunits.ADMINISTRATIVE_UNIT_CHOICES = (('wroclaw', 'Wrocław'), ('jeleniagora', 'Jelenia Góra'), ('legnica', 'Legnica'), ('boleslawiecki', 'bolesławiecki'), ('dzierzoniowski', 'dzierżoniowski'), ('glogowski', 'głogowski'), ('gorowski', 'górowski'), ('jaworski', 'jaworski'), ('jeleniogorski', 'jeleniogórski'), ('kamiennogorski', 'kamiennogórski'), ('klodzki', 'kłodzki'), ('legnicki', 'legnicki'), ('lubanski', 'lubański'), ('lubinski', 'lubiński'), ('lwowecki', 'lwówecki'), ('milicki', 'milicki'), ('olesnicki', 'oleśnicki'), ('olawski', 'oławski'), ('polkowicki', 'polkowicki'), ('strzelinski', 'strzeliński'), ('sredzki', 'średzki'), ('swidnicki', 'świdnicki'), ('trzebnicki', 'trzebnicki'), ('walbrzyski', 'wałbrzyski'), ('wolowski', 'wołowski'), ('wroclawski', 'wrocławski'), ('zabkowicki', 'ząbkowicki'), ('zgorzelecki', 'zgorzelecki'), ('zlotoryjski', 'złotoryjski'), ('bydgoszcz', 'Bydgoszcz'), ('torun', 'Toruń'), ('wloclawek', 'Włocławek'), ('grudziadz', 'Grudziądz'), ('aleksandrowski', 'aleksandrowski'), ('brodnicki', 'brodnicki'), ('bydgoski', 'bydgoski'), ('chelminski', 'chełmiński'), ('golubsko-dobrzynski', 'golubsko-dobrzyński'), ('grudziadzki', 'grudziądzki'), ('inowroclawski', 'inowrocławski'), ('lipnowski', 'lipnowski'), ('mogilenski', 'mogileński'), ('nakielski', 'nakielski'), ('radziejowski', 'radziejowski'), ('rypinski', 'rypiński'), ('sepolenski', 'sępoleński'), ('swiecki', 'świecki'), ('torunski', 'toruński'), ('tucholski', 'tucholski'), ('wabrzeski', 'wąbrzeski'), ('wloclawski', 'włocławski'), ('zninski', 'żniński'), ('lublin', 'Lublin'), ('biala-podlaska', 'Biała Podlaska'), ('chelm', 'Chełm'), ('zamosc', 'Zamość'), ('bialski', 'bialski'), ('bilgorajski', 'biłgorajski'), ('chelmski', 'chełmski'), ('hrubieszowski', 'hrubieszowski'), ('janowski', 'janowski'), ('krasnostawski', 'krasnostawski'), ('krasnicki', 'kraśnicki'), ('lubartowski', 'lubartowski'), ('lubelski', 'lubelski'), ('leczynski', 'łęczyński'), ('lukowski', 'łukowski'), ('opolski', 'opolski'), ('parczewski', 'parczewski'), ('pulawski', 'puławski'), ('radzynski', 'radzyński'), ('rycki', 'rycki'), ('swidnicki', 'świdnicki'), ('tomaszowski', 'tomaszowski'), ('wlodawski', 'włodawski'), ('zamojski', 'zamojski'), ('gorzow-wielkopolski', 'Gorzów Wielkopolski'), ('zielona-gora', 'Zielona Góra'), ('gorzowski', 'gorzowski'), ('krosnienski', 'krośnieński'), ('miedzyrzecki', 'międzyrzecki'), ('nowosolski', 'nowosolski'), ('slubicki', 'słubicki'), ('strzelecko-drezdenecki', 'strzelecko-drezdenecki'), ('sulecinski', 'suleńciński'), ('swiebodzinski', 'świebodziński'), ('wschowski', 'wschowski'), ('zielonogorski', 'zielonogórski'), ('zaganski', 'żagański'), ('zarski', 'żarski'), ('lodz', 'Łódź'), ('piotrkow-trybunalski', 'Piotrków Trybunalski'), ('skierniewice', 'Skierniewice'), ('belchatowski', 'bełchatowski'), ('brzezinski', 'brzeziński'), ('kutnowski', 'kutnowski'), ('laski', 'łaski'), ('leczycki', 'łęczycki'), ('lowicki', 'łowicki'), ('lodzki wschodni', 'łódzki wschodni'), ('opoczynski', 'opoczyński'), ('pabianicki', 'pabianicki'), ('pajeczanski', 'pajęczański'), ('piotrkowski', 'piotrkowski'), ('poddebicki', 'poddębicki'), ('radomszczanski', 'radomszczański'), ('rawski', 'rawski'), ('sieradzki', 'sieradzki'), ('skierniewicki', 'skierniewicki'), ('tomaszowski', 'tomaszowski'), ('wielunski', 'wieluński'), ('wieruszowski', 'wieruszowski'), ('zdunskowolski', 'zduńskowolski'), ('zgierski', 'zgierski'), ('krakow', 'Kraków'), ('tarnow', 'Tarnów'), ('nowy-sacz', 'Nowy Sącz'), ('bochenski', 'bocheński'), ('brzeski', 'brzeski'), ('chrzanowski', 'chrzanowski'), ('dabrowski', 'dąbrowski'), ('gorlicki', 'gorlicki'), ('krakowski', 'krakowski'), ('limanowski', 'limanowski'), ('miechowski', 'miechowski'), ('myslenicki', 'myślenicki'), ('nowosadecki', 'nowosądecki'), ('nowotarski', 'nowotarski'), ('olkuski', 'olkuski'), ('oswiecimski', 'oświęcimski'), ('proszowicki', 'proszowicki'), ('suski', 'suski'), ('tarnowski', 'tarnowski'), ('tatrzanski', 'tatrzański'), ('wadowicki', 'wadowicki'), ('wielicki', 'wielicki'), ('warszawa', 'Warszawa'), ('ostroleka', 'Ostrołęka'), ('plock', 'Płock'), ('radom', 'Radom'), ('siedlce', 'Siedlce'), ('bialobrzeski', 'białobrzeski'), ('ciechanowski', 'ciechanowski'), ('garwolinski', 'garwoliński'), ('gostyninski', 'gostyniński'), ('grodziski', 'grodziski'), ('grojecki', 'grójecki'), ('kozienicki', 'kozenicki'), ('legionowski', 'legionowski'), ('lipski', 'lipski'), ('losicki', 'łosicki'), ('makowski', 'makowski'), ('minski', 'miński'), ('mlawski', 'mławski'), ('nowodworski', 'nowodworski'), ('ostrolecki', 'ostrołęcki'), ('ostrowski', 'ostrowski'), ('otwocki', 'otwocki'), ('piaseczynski', 'piaseczyński'), ('plocki', 'płocki'), ('plonski', 'płoński'), ('pruszkowski', 'pruszkowski'), ('przasnyski', 'przasnyski'), ('przysuski', 'przysuski'), ('pultuski', 'pułtuski'), ('radomski', 'radomski'), ('siedlecki', 'siedlecki'), ('sierpecki', 'sierpecki'), ('sochaczewski', 'sochaczewski'), ('sokolowski', 'sokołowski'), ('szydlowiecki', 'szydłowiecki'), ('warszawski-zachodni', 'warszawski zachodni'), ('wegrowski', 'węgrowski'), ('wolominski', 'wołomiński'), ('wyszkowski', 'wyszkowski'), ('zwolenski', 'zwoleński'), ('zurominski', 'żuromiński'), ('zyrardowski', 'żyrardowski'), ('opole', 'Opole'), ('brzeski', 'brzeski'), ('glubczycki', 'głubczyski'), ('kedzierzynsko-kozielski', 'kędzierzyńsko-kozielski'), ('kluczborski', 'kluczborski'), ('krapkowicki', 'krapkowicki'), ('namyslowski', 'namysłowski'), ('nyski', 'nyski'), ('oleski', 'oleski'), ('opolski', 'opolski'), ('prudnicki', 'prudnicki'), ('strzelecki', 'strzelecki'), ('rzeszow', 'Rzeszów'), ('krosno', 'Krosno'), ('przemysl', 'Przemyśl'), ('tarnobrzeg', 'Tarnobrzeg'), ('bieszczadzki', 'bieszczadzki'), ('brzozowski', 'brzozowski'), ('debicki', 'dębicki'), ('jaroslawski', 'jarosławski'), ('jasielski', 'jasielski'), ('kolbuszowski', 'kolbuszowski'), ('krosnienski', 'krośnieński'), ('leski', 'leski'), ('lezajski', 'leżajski'), ('lubaczowski', 'lubaczowski'), ('lancucki', 'łańcucki'), ('mielecki', 'mielecki'), ('nizanski', 'niżański'), ('przemyski', 'przemyski'), ('przeworski', 'przeworski'), ('ropczycko-sedziszowski', 'ropczycko-sędziszowski'), ('rzeszowski', 'rzeszowski'), ('sanocki', 'sanocki'), ('stalowowolski', 'stalowowolski'), ('strzyzowski', 'strzyżowski'), ('tarnobrzeski', 'tarnobrzeski'), ('bialystok', 'Białystok'), ('lomza', 'Łomża'), ('suwalki', 'Suwałki'), ('augustowski', 'augustowski'), ('bialostocki', 'białostocki'), ('bielski', 'bielski'), ('grajewski', 'grajewski'), ('hajnowski', 'hajnowski'), ('kolnenski', 'kolneński'), ('łomzynski', 'łomżyński'), ('moniecki', 'moniecki'), ('sejnenski', 'sejneński'), ('siemiatycki', 'siematycki'), ('sokolski', 'sokólski'), ('suwalski', 'suwalski'), ('wysokomazowiecki', 'wysokomazowiecki'), ('zambrowski', 'zambrowski'), ('gdansk', 'Gdańsk'), ('gdynia', 'Gdynia'), ('slupsk', 'Słupsk'), ('sopot', 'Sopot'), ('bytowski', 'bytowski'), ('chojnicki', 'chojnicki'), ('czluchowski', 'człuchowski'), ('kartuski', 'kartuski'), ('koscierski', 'kościerski'), ('kwidzynski', 'kwidzyński'), ('leborski', 'lęborski'), ('malborski', 'malborski'), ('nowodworski', 'nowodworski'), ('gdanski', 'gdański'), ('pucki', 'pucki'), ('slupski', 'słupski'), ('starogardzki', 'starogardzki'), ('sztumski', 'sztumski'), ('tczewski', 'tczewski'), ('wejherowski', 'wejcherowski'), ('katowice', 'Katowice'), ('bielsko-biala', 'Bielsko-Biała'), ('bytom', 'Bytom'), ('chorzow', 'Chorzów'), ('czestochowa', 'Częstochowa'), ('dabrowa-gornicza', 'Dąbrowa Górnicza'), ('gliwice', 'Gliwice'), ('jastrzebie-zdroj', 'Jastrzębie Zdrój'), ('jaworzno', 'Jaworzno'), ('myslowice', 'Mysłowice'), ('piekary-slaskie', 'Piekary Śląskie'), ('ruda-slaska', 'Ruda Śląska'), ('rybnik', 'Rybnik'), ('siemianowice-slaskie', 'Siemianowice Śląskie'), ('sosnowiec', 'Sosnowiec'), ('swietochlowice', 'Świętochłowice'), ('tychy', 'Tychy'), ('zabrze', 'Zabrze'), ('zory', 'Żory'), ('bedzinski', 'będziński'), ('bielski', 'bielski'), ('bierunsko-ledzinski', 'bieruńsko-lędziński'), ('cieszynski', 'cieszyński'), ('czestochowski', 'częstochowski'), ('gliwicki', 'gliwicki'), ('klobucki', 'kłobucki'), ('lubliniecki', 'lubliniecki'), ('mikolowski', 'mikołowski'), ('myszkowski', 'myszkowski'), ('pszczynski', 'pszczyński'), ('raciborski', 'raciborski'), ('rybnicki', 'rybnicki'), ('tarnogorski', 'tarnogórski'), ('wodzislawski', 'wodzisławski'), ('zawiercianski', 'zawierciański'), ('zywiecki', 'żywiecki'), ('kielce', 'Kielce'), ('buski', 'buski'), ('jedrzejowski', 'jędrzejowski'), ('kazimierski', 'kazimierski'), ('kielecki', 'kielecki'), ('konecki', 'konecki'), ('opatowski', 'opatowski'), ('ostrowiecki', 'ostrowiecki'), ('pinczowski', 'pińczowski'), ('sandomierski', 'sandomierski'), ('skarzyski', 'skarżyski'), ('starachowicki', 'starachowicki'), ('staszowski', 'staszowski'), ('wloszczowski', 'włoszczowski'), ('olsztyn', 'Olsztyn'), ('elblag', 'Elbląg'), ('bartoszycki', 'bartoszycki'), ('braniewski', 'braniewski'), ('dzialdowski', 'działdowski'), ('elblaski', 'elbląski'), ('elcki', 'ełcki'), ('gizycki', 'giżycki'), ('goldapski', 'gołdapski'), ('ilawski', 'iławski'), ('ketrzynski', 'kętrzyński'), ('lidzbarski', 'lidzbarski'), ('mragowski', 'mrągowski'), ('nidzicki', 'nidzicki'), ('nowomiejski', 'nowomiejski'), ('olecki', 'olecki'), ('olsztynski', 'olsztyński'), ('ostrodzki', 'ostródzki'), ('piski', 'piski'), ('szczycienski', 'szczycieński'), ('wegorzewski', 'węgorzewski'), ('poznan', 'Poznań'), ('kalisz', 'Kalisz'), ('konin', 'Konin'), ('leszno', 'Leszno'), ('chodzieski', 'chodziejski'), ('czarnkowsko-trzcianecki', 'czarnkowsko-trzcianecki'), ('gnieznienski', 'gnieźnieński'), ('gostynski', 'gostyński'), ('grodziski', 'grodziski'), ('jarocinski', 'jarociński'), ('kaliski', 'kaliski'), ('kepinski', 'kępiński'), ('kolski', 'kolski'), ('koninski', 'koniński'), ('koscianski', 'kościański'), ('krotoszynski', 'krotoszyński'), ('leszczynski', 'leszczyński'), ('miedzychodzki', 'międzychodzki'), ('nowotomyski', 'nowotomyski'), ('obornicki', 'obornicki'), ('ostrowski', 'ostrowski'), ('ostrzeszowski', 'ostrzeszowski'), ('pilski', 'pilski'), ('pleszewski', 'pleszewski'), ('poznanski', 'poznański'), ('rawicki', 'rawicki'), ('slupecki', 'słupecki'), ('szamotulski', 'szamotulski'), ('sredzki', 'średzki'), ('sremski', 'śremski'), ('turecki', 'turecki'), ('wagrowiecki', 'wągrowiecki'), ('wolsztynski', 'wolsztyński'), ('wrzesinski', 'wrzesiński'), ('zlotowski', 'złotowski'), ('bialogardzki', 'białogardzki'), ('choszczenski', 'choszczeński'), ('drawski', 'drawski'), ('goleniowski', 'goleniowski'), ('gryficki', 'gryficki'), ('gryfinski', 'gryfiński'), ('kamienski', 'kamieński'), ('kolobrzeski', 'kołobrzeski'), ('koszalinski', 'koszaliński'), ('lobeski', 'łobeski'), ('mysliborski', 'myśliborski'), ('policki', 'policki'), ('pyrzycki', 'pyrzycki'), ('slawienski', 'sławieński'), ('stargardzki', 'stargardzki'), ('szczecinecki', 'szczecinecki'), ('swidwinski', 'świdwiński'), ('walecki', 'wałecki'))

Polish administrative units as in http://pl.wikipedia.org/wiki/Podzia%C5%82_administracyjny_Polski

localflavor.pl.pl_voivodeships.VOIVODESHIP_CHOICES = (('lower_silesia', 'Lower Silesian'), ('kuyavia-pomerania', 'Kuyavian-Pomeranian'), ('lublin', 'Lublin'), ('lubusz', 'Lubusz'), ('lodz', 'Lodz'), ('lesser_poland', 'Lesser Poland'), ('masovia', 'Masovian'), ('opole', 'Opole'), ('subcarpatia', 'Subcarpathian'), ('podlasie', 'Podlasie'), ('pomerania', 'Pomeranian'), ('silesia', 'Silesian'), ('swietokrzyskie', 'Swietokrzyskie'), ('warmia-masuria', 'Warmian-Masurian'), ('greater_poland', 'Greater Poland'), ('west_pomerania', 'West Pomeranian'))

Polish voivodeship as in http://en.wikipedia.org/wiki/Poland#Administrative_division

Portugal (pt)

Forms

django_localflavot_pt.forms

Contains PT-specific Django form helpers.

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

A field which validates Portuguese Citizen Card numbers (locally CC - ‘Cartão do Cidadão’).

  • Citizen Card numbers have the format XXXXXXXXXYYX or XXXXXXXX-XYYX
    (where X is a digit and Y is an alphanumeric character).
  • Citizen Card numbers validate as per http://bit.ly/RP0BzW.
  • The input string may or may not have an hyphen separating the identity number from the document’s check-digits.
  • This field does NOT validate old ID card numbers (locally BI - ‘Bilhete de Identidade’).
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.pt.forms.PTRegionSelect(attrs=None)[source]

A select widget which uses a list of Portuguese regions as its choices.

  • Regions correspond to the Portuguese ‘distritos’ and ‘regiões autónomas’ as per ISO3166:2-PT.
class localflavor.pt.forms.PTSocialSecurityNumberField(*, max_length=None, min_length=None, strip=True, empty_value='', **kwargs)[source]

A field which validates Portuguese Social Security numbers.

(locally NISS - ‘Número de Identificação na Segurança Social’). - Social Security numbers must be in the format XYYYYYYYYYY (where X is either 1 or 2 and Y is any other digit).

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.pt.forms.PTZipCodeField(**kwargs)[source]

A field which validates Portuguese zip codes.

NOTE - Zip codes have the format XYYY-YYY (where X is a digit between 1 and 9 and Y is any other digit).

Data

localflavor.pt.pt_regions.REGION_CHOICES = (('01', 'Aveiro'), ('02', 'Beja'), ('03', 'Braga'), ('04', 'Bragança'), ('05', 'Castelo Branco'), ('06', 'Coimbra'), ('07', 'Évora'), ('08', 'Faro'), ('09', 'Guarda'), ('10', 'Leiria'), ('11', 'Lisboa'), ('12', 'Portalegre'), ('13', 'Porto'), ('14', 'Santarém'), ('15', 'Setúbal'), ('16', 'Viana do Castelo'), ('17', 'Vila Real'), ('18', 'Viseu'), ('20', 'Região Autónoma da Madeira'), ('30', 'Região Autónoma dos Açores'))

A tuple representing Portuguese regions (as per ISO3166:2-PT).

Paraguay (py)

Forms

PY-specific Form helpers.

class localflavor.py_.forms.PyDepartmentSelect(attrs=None)[source]

A Select widget with a list of Paraguayan departments as choices.

class localflavor.py_.forms.PyNumberedDepartmentSelect(attrs=None)[source]

A Select widget with a roman numbered list of Paraguayan departments as choices.

Data

localflavor.py_.py_department.DEPARTMENT_CHOICES = (('AG', 'Alto Paraguay'), ('AA', 'Alto Paraná'), ('AM', 'Amambay'), ('AS', 'Asunción'), ('BQ', 'Boquerón'), ('CG', 'Caaguazú'), ('CZ', 'Caazapá'), ('CY', 'Canindeyú'), ('CE', 'Central'), ('CN', 'Concepción'), ('CR', 'Cordillera'), ('GU', 'Guairá'), ('IT', 'Itapúa'), ('MI', 'Misiones'), ('NE', 'Ñeembucú'), ('PG', 'Paraguarí'), ('PH', 'Pdte. Hayes'), ('SP', 'San Pedro'))

http://www.statoids.com/upy.html

localflavor.py_.py_department.DEPARTMENT_ROMAN_CHOICES = (('CN', 'I Concepción'), ('SP', 'II San Pedro'), ('CR', 'III Cordillera'), ('GU', 'IV Guairá'), ('CG', 'V Caaguazú'), ('CZ', 'VI Caazapá'), ('IT', 'VII Itapúa'), ('MI', 'VIII Misiones'), ('PG', 'IX Paraguarí'), ('AA', 'X Alto Paraná'), ('CE', 'XI Central'), ('NE', 'XII Ñeembucú'), ('AM', 'XIII Amambay'), ('CY', 'XIV Canindeyú'), ('PH', 'XV Pdte. Hayes'), ('AG', 'XVI Alto Paraguay'), ('BQ', 'XVII Boquerón'), ('AS', 'XVIII Asunción'))

list of departments sorted by its roman number

Romania (ro)

Forms

Romanian specific form helpers.

class localflavor.ro.forms.ROCIFField(max_length=10, min_length=2, **kwargs)[source]

A Romanian fiscal identity code (CIF) field.

For CIF validation algorithm see: https://ro.wikipedia.org/wiki/Cod_de_Identificare_Fiscal%C4%83

clean(value)[source]

CIF validation.

Args:
value: the CIF code
class localflavor.ro.forms.ROCNPField(max_length=13, min_length=13, **kwargs)[source]

A Romanian personal identity code (CNP) field.

For CNP validation algorithm see: https://ro.wikipedia.org/wiki/Cod_numeric_personal

clean(value)[source]

CNP validations.

Args:
value: the CNP code
class localflavor.ro.forms.ROCountyField(*, max_length=None, min_length=None, strip=True, empty_value='', **kwargs)[source]

A form field that validates its input is a Romanian county name or abbreviation.

It normalizes the input to the standard vehicle registration abbreviation for the given county.

WARNING: This field will only accept names written with diacritics (using comma bellow for ș and ț); consider using ROCountySelect if this behavior is unacceptable for you

For more information regarding diacritics see Comma-below (ș and ț) versus cedilla (ş and ţ) and Unicode and HTML sections from: Romanian alphabet.

Example:
Argeș => valid (comma bellow)
Argeş => invalid (cedilla)
Arges => invalid (no diacritic)
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.ro.forms.ROCountySelect(attrs=None)[source]

A Select widget that uses a list of Romanian counties (județe) as its choices.

class localflavor.ro.forms.ROPostalCodeField(max_length=6, min_length=6, **kwargs)[source]

Romanian postal code field.

Data

localflavor.ro.ro_counties.COUNTIES_CHOICES = (('AB', 'Alba'), ('AR', 'Arad'), ('AG', 'Argeș'), ('BC', 'Bacău'), ('BH', 'Bihor'), ('BN', 'Bistrița-Năsăud'), ('BT', 'Botoșani'), ('BV', 'Brașov'), ('BR', 'Brăila'), ('B', 'București'), ('BZ', 'Buzău'), ('CS', 'Caraș-Severin'), ('CL', 'Călărași'), ('CJ', 'Cluj'), ('CT', 'Constanța'), ('CV', 'Covasna'), ('DB', 'Dâmbovița'), ('DJ', 'Dolj'), ('GL', 'Galați'), ('GR', 'Giurgiu'), ('GJ', 'Gorj'), ('HR', 'Harghita'), ('HD', 'Hunedoara'), ('IL', 'Ialomița'), ('IS', 'Iași'), ('IF', 'Ilfov'), ('MM', 'Maramureș'), ('MH', 'Mehedinți'), ('MS', 'Mureș'), ('NT', 'Neamț'), ('OT', 'Olt'), ('PH', 'Prahova'), ('SM', 'Satu Mare'), ('SJ', 'Sălaj'), ('SB', 'Sibiu'), ('SV', 'Suceava'), ('TR', 'Teleorman'), ('TM', 'Timiș'), ('TL', 'Tulcea'), ('VS', 'Vaslui'), ('VL', 'Vâlcea'), ('VN', 'Vrancea'))

A list of Romanian counties as choices in a formfield.

Russia (ru)

Forms

Russian-specific forms helpers.

class localflavor.ru.forms.RUAlienPassportNumberField(**kwargs)[source]

Russian alien’s passport number format.

XX XXXXXXX where X - any digit.

class localflavor.ru.forms.RUCountySelect(attrs=None)[source]

A Select widget that uses a list of Russian Counties as its choices.

class localflavor.ru.forms.RUPassportNumberField(**kwargs)[source]

Russian internal passport number format.

XXXX XXXXXX where X - any digit.

class localflavor.ru.forms.RUPostalCodeField(**kwargs)[source]

Russian Postal code field.

Format: XXXXXX, where X is any digit, and first digit is not zero.

class localflavor.ru.forms.RURegionSelect(attrs=None)[source]

A Select widget that uses a list of Russian Regions as its choices.

Data

localflavor.ru.ru_regions.RU_COUNTY_CHOICES = (('Central Federal County', 'Central Federal County'), ('South Federal County', 'South Federal County'), ('North-West Federal County', 'North-West Federal County'), ('Far-East Federal County', 'Far-East Federal County'), ('Siberian Federal County', 'Siberian Federal County'), ('Ural Federal County', 'Ural Federal County'), ('Privolzhsky Federal County', 'Privolzhsky Federal County'), ('North-Caucasian Federal County', 'North-Caucasian Federal County'))

http://ru.wikipedia.org/wiki/Коды_субъектов_Российской_Федерации

localflavor.ru.ru_regions.RU_REGIONS_CHOICES = (('77', 'Moskva'), ('78', 'Saint-Peterburg'), ('50', "Moskovskaya oblast'"), ('01', 'Adygeya, Respublika'), ('02', 'Bashkortostan, Respublika'), ('03', 'Buryatia, Respublika'), ('04', 'Altay, Respublika'), ('05', 'Dagestan, Respublika'), ('06', 'Ingushskaya Respublika'), ('07', 'Kabardino-Balkarskaya Respublika'), ('08', 'Kalmykia, Respublika'), ('09', 'Karachaevo-Cherkesskaya Respublika'), ('10', 'Karelia, Respublika'), ('11', 'Komi, Respublika'), ('12', 'Mariy Ehl, Respublika'), ('13', 'Mordovia, Respublika'), ('14', 'Sakha, Respublika (Yakutiya)'), ('15', 'Severnaya Osetia, Respublika (Alania)'), ('16', 'Tatarstan, Respublika'), ('17', 'Tyva, Respublika (Tuva)'), ('18', 'Udmurtskaya Respublika'), ('19', 'Khakassiya, Respublika'), ('95', 'Chechenskaya Respublika'), ('21', 'Chuvashskaya Respublika'), ('22', 'Altayskiy Kray'), ('80', 'Zabaykalskiy Kray'), ('82', 'Kamchatskiy Kray'), ('23', 'Krasnodarskiy Kray'), ('24', 'Krasnoyarskiy Kray'), ('81', 'Permskiy Kray'), ('25', 'Primorskiy Kray'), ('26', "Stavropol'siyy Kray"), ('27', 'Khabarovskiy Kray'), ('28', "Amurskaya oblast'"), ('29', "Arkhangel'skaya oblast'"), ('30', "Astrakhanskaya oblast'"), ('31', "Belgorodskaya oblast'"), ('32', "Bryanskaya oblast'"), ('33', "Vladimirskaya oblast'"), ('34', "Volgogradskaya oblast'"), ('35', "Vologodskaya oblast'"), ('36', "Voronezhskaya oblast'"), ('37', "Ivanovskaya oblast'"), ('38', "Irkutskaya oblast'"), ('39', "Kaliningradskaya oblast'"), ('40', "Kaluzhskaya oblast'"), ('42', "Kemerovskaya oblast'"), ('43', "Kirovskaya oblast'"), ('44', "Kostromskaya oblast'"), ('45', "Kurganskaya oblast'"), ('46', "Kurskaya oblast'"), ('47', "Leningradskaya oblast'"), ('48', "Lipeckaya oblast'"), ('49', "Magadanskaya oblast'"), ('51', "Murmanskaya oblast'"), ('52', "Nizhegorodskaja oblast'"), ('53', "Novgorodskaya oblast'"), ('54', "Novosibirskaya oblast'"), ('55', "Omskaya oblast'"), ('56', "Orenburgskaya oblast'"), ('57', "Orlovskaya oblast'"), ('58', "Penzenskaya oblast'"), ('60', "Pskovskaya oblast'"), ('61', "Rostovskaya oblast'"), ('62', "Rjazanskaya oblast'"), ('63', "Samarskaya oblast'"), ('64', "Saratovskaya oblast'"), ('65', "Sakhalinskaya oblast'"), ('66', "Sverdlovskaya oblast'"), ('67', "Smolenskaya oblast'"), ('68', "Tambovskaya oblast'"), ('69', "Tverskaya oblast'"), ('70', "Tomskaya oblast'"), ('71', "Tul'skaya oblast'"), ('72', "Tyumenskaya oblast'"), ('73', "Ul'ianovskaya oblast'"), ('74', "Chelyabinskaya oblast'"), ('76', "Yaroslavskaya oblast'"), ('79', "Evreyskaya avtonomnaja oblast'"), ('83', 'Neneckiy autonomnyy okrug'), ('86', 'Khanty-Mansiyskiy avtonomnyy okrug - Yugra'), ('87', 'Chukotskiy avtonomnyy okrug'), ('89', 'Yamalo-Neneckiy avtonomnyy okrug'))

http://ru.wikipedia.org/wiki/Федеральные_округа_Российской_Федерации

Sweden (se)

Forms

Swedish specific Form helpers.

class localflavor.se.forms.SECountySelect(attrs=None)[source]

A Select form widget that uses a list of the Swedish counties (län) as its choices.

The cleaned value is the official county code – see http://en.wikipedia.org/wiki/Counties_of_Sweden for a list.

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

A form field that validates input as a Swedish organisation number (organisationsnummer).

It accepts the same input as SEPersonalIdentityField (for sole proprietorships (enskild firma). However, co-ordination numbers are not accepted.

It also accepts ordinary Swedish organisation numbers with the format NNNNNNNNNN.

The return value will be YYYYMMDDXXXX for sole proprietors, and NNNNNNNNNN for other organisations.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.se.forms.SEPersonalIdentityNumberField(coordination_number=True, interim_number=False, **kwargs)[source]

A form field that validates input as a Swedish personal identity number (personnummer).

The correct formats are YYYYMMDD-XXXX, YYYYMMDDXXXX, YYMMDD-XXXX, YYMMDDXXXX and YYMMDD+XXXX.

A + indicates that the person is older than 100 years, which will be taken into consideration when the date is validated.

The checksum will be calculated and checked. The birth date is checked to be a valid date.

By default, co-ordination numbers (samordningsnummer) will be accepted. To only allow real personal identity numbers, pass the keyword argument coordination_number=False to the constructor.

Interim numbers (interimspersonnummer), used by educational institutions within the Ladok system, are supported but not accepted by default, since they are not considered valid outside Ladok. They have the same format and semantics as real personal identity numbers, except that the first control digit is replaced by a letter (A-Z). To allow the use of interim numbers, pass the keyword argument interim_numbers=True to the constructor.

The cleaned value will always have the format YYYYMMDDXXXX.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.se.forms.SEPostalCodeField(**kwargs)[source]

A form field that validates input as a Swedish postal code (postnummer).

Valid codes consist of five digits (XXXXX). The number can optionally be formatted with a space after the third digit (XXX XX).

The cleaned value will never contain the space.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Utilities

localflavor.se.utils.id_number_checksum(gd)[source]

Calculates a Swedish ID number checksum, using the “Luhn”-algoritm.

localflavor.se.utils.validate_id_birthday(gd, fix_coordination_number_day=True)[source]

Validates the birth_day and returns the datetime.date object for the birth_day.

If the date is an invalid birth day, a ValueError will be raised.

Data

localflavor.se.se_counties.COUNTY_CHOICES = (('AB', 'Stockholm'), ('AC', 'Västerbotten'), ('BD', 'Norrbotten'), ('C', 'Uppsala'), ('D', 'Södermanland'), ('E', 'Östergötland'), ('F', 'Jönköping'), ('G', 'Kronoberg'), ('H', 'Kalmar'), ('I', 'Gotland'), ('K', 'Blekinge'), ('M', 'Skåne'), ('N', 'Halland'), ('O', 'Västra Götaland'), ('S', 'Värmland'), ('T', 'Örebro'), ('U', 'Västmanland'), ('W', 'Dalarna'), ('X', 'Gävleborg'), ('Y', 'Västernorrland'), ('Z', 'Jämtland'))

An alphabetical list of Swedish counties, sorted by codes. http://en.wikipedia.org/wiki/Counties_of_Sweden

Singapore (sg)

New in version 1.1.

Forms

Singapore-specific Form helpers.

Slovenia (si)

Forms

Slovenian specific form helpers.

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

A form for validating Slovenian personal identification number.

Additionally stores gender, nationality and birthday to self.info dictionary.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.si.forms.SIPostalCodeField(**kwargs)[source]

Slovenian post codes field.

class localflavor.si.forms.SIPostalCodeSelect(attrs=None)[source]

A Select widget that uses Slovenian postal codes as its choices.

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

Slovenian tax number field.

Valid input is SIXXXXXXXX or XXXXXXXX where X is a number.

http://zylla.wipos.p.lodz.pl/ut/translation.html#PZSI

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Data

localflavor.si.si_postalcodes.SI_POSTALCODES = [(1000, 'Ljubljana'), (1215, 'Medvode'), (1216, 'Smlednik'), (1217, 'Vodice'), (1218, 'Komenda'), (1219, 'Laze v Tuhinju'), (1221, 'Motnik'), (1222, 'Trojane'), (1223, 'Blagovica'), (1225, 'Lukovica'), (1230, 'Domžale'), (1233, 'Dob'), (1234, 'Mengeš'), (1235, 'Radomlje'), (1236, 'Trzin'), (1241, 'Kamnik'), (1242, 'Stahovica'), (1251, 'Moravče'), (1252, 'Vače'), (1262, 'Dol pri Ljubljani'), (1270, 'Litija'), (1272, 'Polšnik'), (1273, 'Dole pri Litiji'), (1274, 'Gabrovka'), (1275, 'Šmartno pri Litiji'), (1276, 'Primskovo'), (1281, 'Kresnice'), (1282, 'Sava'), (1290, 'Grosuplje'), (1291, 'Škofljica'), (1292, 'Ig'), (1293, 'Šmarje - Sap'), (1294, 'Višnja Gora'), (1295, 'Ivančna Gorica'), (1296, 'Šentvid pri Stični'), (1301, 'Krka'), (1303, 'Zagradec'), (1310, 'Ribnica'), (1311, 'Turjak'), (1312, 'Videm - Dobrepolje'), (1313, 'Struge'), (1314, 'Rob'), (1315, 'Velike Lašče'), (1316, 'Ortnek'), (1317, 'Sodražica'), (1318, 'Loški Potok'), (1319, 'Draga'), (1330, 'Kočevje'), (1331, 'Dolenja vas'), (1332, 'Stara Cerkev'), (1336, 'Kostel'), (1337, 'Osilnica'), (1338, 'Kočevska Reka'), (1351, 'Brezovica pri Ljubljani'), (1352, 'Preserje'), (1353, 'Borovnica'), (1354, 'Horjul'), (1355, 'Polhov Gradec'), (1356, 'Dobrova'), (1357, 'Notranje Gorice'), (1358, 'Log pri Brezovici'), (1360, 'Vrhnika'), (1370, 'Logatec'), (1372, 'Hotedršica'), (1373, 'Rovte'), (1380, 'Cerknica'), (1381, 'Rakek'), (1382, 'Begunje pri Cerknici'), (1384, 'Grahovo'), (1385, 'Nova vas'), (1386, 'Stari trg pri Ložu'), (1410, 'Zagorje ob Savi'), (1411, 'Izlake'), (1412, 'Kisovec'), (1413, 'Čemšenik'), (1414, 'Podkum'), (1420, 'Trbovlje'), (1423, 'Dobovec'), (1430, 'Hrastnik'), (1431, 'Dol pri Hrastniku'), (1432, 'Zidani Most'), (1433, 'Radeče'), (1434, 'Loka pri Zidanem Mostu'), (2000, 'Maribor'), (2201, 'Zgornja Kungota'), (2204, 'Miklavž na Dravskem polju'), (2205, 'Starše'), (2206, 'Marjeta na Dravskem polju'), (2208, 'Pohorje'), (2211, 'Pesnica pri Mariboru'), (2212, 'Šentilj v Slovenskih goricah'), (2213, 'Zgornja Velka'), (2214, 'Sladki vrh'), (2215, 'Ceršak'), (2221, 'Jarenina'), (2222, 'Jakobski Dol'), (2223, 'Jurovski Dol'), (2229, 'Malečnik'), (2230, 'Lenart v Slovenskih goricah'), (2231, 'Pernica'), (2232, 'Voličina'), (2233, 'Sveta Ana v Slovenskih goricah'), (2234, 'Benedikt'), (2235, 'Sveta Trojica v Slovenskih goricah'), (2236, 'Cerkvenjak'), (2241, 'Spodnji Duplek'), (2242, 'Zgornja Korena'), (2250, 'Ptuj'), (2252, 'Dornava'), (2253, 'Destrnik'), (2254, 'Trnovska vas'), (2255, 'Vitomarci'), (2256, 'Juršinci'), (2257, 'Polenšak'), (2258, 'Sveti Tomaž'), (2259, 'Ivanjkovci'), (2270, 'Ormož'), (2272, 'Gorišnica'), (2273, 'Podgorci'), (2274, 'Velika Nedelja'), (2275, 'Miklavž pri Ormožu'), (2276, 'Kog'), (2277, 'Središče ob Dravi'), (2281, 'Markovci'), (2282, 'Cirkulane'), (2283, 'Zavrč'), (2284, 'Videm pri Ptuju'), (2285, 'Zgornji Leskovec'), (2286, 'Podlehnik'), (2287, 'Žetale'), (2288, 'Hajdina'), (2289, 'Stoperce'), (2310, 'Slovenska Bistrica'), (2311, 'Hoče'), (2312, 'Orehova vas'), (2313, 'Fram'), (2314, 'Zgornja Polskava'), (2315, 'Šmartno na Pohorju'), (2316, 'Zgornja Ložnica'), (2317, 'Oplotnica'), (2318, 'Laporje'), (2319, 'Poljčane'), (2321, 'Makole'), (2322, 'Majšperk'), (2323, 'Ptujska Gora'), (2324, 'Lovrenc na Dravskem polju'), (2325, 'Kidričevo'), (2326, 'Cirkovce'), (2327, 'Rače'), (2331, 'Pragersko'), (2341, 'Limbuš'), (2342, 'Ruše'), (2343, 'Fala'), (2344, 'Lovrenc na Pohorju'), (2345, 'Bistrica ob Dravi'), (2351, 'Kamnica'), (2352, 'Selnica ob Dravi'), (2353, 'Sv. Duh na Ostrem Vrhu'), (2354, 'Bresternica'), (2360, 'Radlje ob Dravi'), (2361, 'Ožbalt'), (2362, 'Kapla'), (2363, 'Podvelka'), (2364, 'Ribnica na Pohorju'), (2365, 'Vuhred'), (2366, 'Muta'), (2367, 'Vuzenica'), (2370, 'Dravograd'), (2371, 'Trbonje'), (2372, 'Libeliče'), (2373, 'Šentjanž pri Dravogradu'), (2380, 'Slovenj Gradec'), (2381, 'Podgorje pri Slovenj Gradcu'), (2382, 'Mislinja'), (2383, 'Šmartno pri Slovenj Gradcu'), (2390, 'Ravne na Koroškem'), (2391, 'Prevalje'), (2392, 'Mežica'), (2393, 'Črna na Koroškem'), (2394, 'Kotlje'), (3000, 'Celje'), (3201, 'Šmartno v Rožni dolini'), (3202, 'Ljubečna'), (3203, 'Nova Cerkev'), (3204, 'Dobrna'), (3205, 'Vitanje'), (3206, 'Stranice'), (3210, 'Slovenske Konjice'), (3211, 'Škofja vas'), (3212, 'Vojnik'), (3213, 'Frankolovo'), (3214, 'Zreče'), (3215, 'Loče'), (3220, 'Štore'), (3221, 'Teharje'), (3222, 'Dramlje'), (3223, 'Loka pri Žusmu'), (3224, 'Dobje pri Planini'), (3225, 'Planina pri Sevnici'), (3230, 'Šentjur'), (3231, 'Grobelno'), (3232, 'Ponikva'), (3233, 'Kalobje'), (3240, 'Šmarje pri Jelšah'), (3241, 'Podplat'), (3250, 'Rogaška Slatina'), (3252, 'Rogatec'), (3253, 'Pristava pri Mestinju'), (3254, 'Podčetrtek'), (3255, 'Buče'), (3256, 'Bistrica ob Sotli'), (3257, 'Podsreda'), (3260, 'Kozje'), (3261, 'Lesično'), (3262, 'Prevorje'), (3263, 'Gorica pri Slivnici'), (3264, 'Sveti Štefan'), (3270, 'Laško'), (3271, 'Šentrupert'), (3272, 'Rimske Toplice'), (3273, 'Jurklošter'), (3301, 'Petrovče'), (3302, 'Griže'), (3303, 'Gomilsko'), (3304, 'Tabor'), (3305, 'Vransko'), (3310, 'Žalec'), (3311, 'Šempeter v Savinjski dolini'), (3312, 'Prebold'), (3313, 'Polzela'), (3314, 'Braslovče'), (3320, 'Velenje - dostava'), (3322, 'Velenje - poštni predali'), (3325, 'Šoštanj'), (3326, 'Topolšica'), (3327, 'Šmartno ob Paki'), (3330, 'Mozirje'), (3331, 'Nazarje'), (3332, 'Rečica ob Savinji'), (3333, 'Ljubno ob Savinji'), (3334, 'Luče'), (3335, 'Solčava'), (3341, 'Šmartno ob Dreti'), (3342, 'Gornji Grad'), (4000, 'Kranj'), (4201, 'Zgornja Besnica'), (4202, 'Naklo'), (4203, 'Duplje'), (4204, 'Golnik'), (4205, 'Preddvor'), (4206, 'Zgornje Jezersko'), (4207, 'Cerklje na Gorenjskem'), (4208, 'Šenčur'), (4209, 'Žabnica'), (4210, 'Brnik - aerodrom'), (4211, 'Mavčiče'), (4212, 'Visoko'), (4220, 'Škofja Loka'), (4223, 'Poljane nad Škofjo Loko'), (4224, 'Gorenja vas'), (4225, 'Sovodenj'), (4226, 'Žiri'), (4227, 'Selca'), (4228, 'Železniki'), (4229, 'Sorica'), (4240, 'Radovljica'), (4243, 'Brezje'), (4244, 'Podnart'), (4245, 'Kropa'), (4246, 'Kamna Gorica'), (4247, 'Zgornje Gorje'), (4248, 'Lesce'), (4260, 'Bled'), (4263, 'Bohinjska Bela'), (4264, 'Bohinjska Bistrica'), (4265, 'Bohinjsko jezero'), (4267, 'Srednja vas v Bohinju'), (4270, 'Jesenice'), (4273, 'Blejska Dobrava'), (4274, 'Žirovnica'), (4275, 'Begunje na Gorenjskem'), (4276, 'Hrušica'), (4280, 'Kranjska Gora'), (4281, 'Mojstrana'), (4282, 'Gozd Martuljek'), (4283, 'Rateče - Planica'), (4290, 'Tržič'), (4294, 'Križe'), (5000, 'Nova Gorica'), (5210, 'Deskle'), (5211, 'Kojsko'), (5212, 'Dobrovo v Brdih'), (5213, 'Kanal'), (5214, 'Kal nad Kanalom'), (5215, 'Ročinj'), (5216, 'Most na Soči'), (5220, 'Tolmin'), (5222, 'Kobarid'), (5223, 'Breginj'), (5224, 'Srpenica'), (5230, 'Bovec'), (5231, 'Log pod Mangartom'), (5232, 'Soča'), (5242, 'Grahovo ob Bači'), (5243, 'Podbrdo'), (5250, 'Solkan'), (5251, 'Grgar'), (5252, 'Trnovo pri Gorici'), (5253, 'Čepovan'), (5261, 'Šempas'), (5262, 'Črniče'), (5263, 'Dobravlje'), (5270, 'Ajdovščina'), (5271, 'Vipava'), (5272, 'Podnanos'), (5273, 'Col'), (5274, 'Črni Vrh nad Idrijo'), (5275, 'Godovič'), (5280, 'Idrija'), (5281, 'Spodnja Idrija'), (5282, 'Cerkno'), (5283, 'Slap ob Idrijci'), (5290, 'Šempeter pri Gorici'), (5291, 'Miren'), (5292, 'Renče'), (5293, 'Volčja Draga'), (5294, 'Dornberk'), (5295, 'Branik'), (5296, 'Kostanjevica na Krasu'), (5297, 'Prvačina'), (6000, 'Koper'), (6210, 'Sežana'), (6215, 'Divača'), (6216, 'Podgorje'), (6217, 'Vremski Britof'), (6219, 'Lokev'), (6221, 'Dutovlje'), (6222, 'Štanjel'), (6223, 'Komen'), (6224, 'Senožeče'), (6225, 'Hruševje'), (6230, 'Postojna'), (6232, 'Planina'), (6240, 'Kozina'), (6242, 'Materija'), (6243, 'Obrov'), (6244, 'Podgrad'), (6250, 'Ilirska Bistrica'), (6251, 'Ilirska Bistrica - Trnovo'), (6253, 'Knežak'), (6254, 'Jelšane'), (6255, 'Prem'), (6256, 'Košana'), (6257, 'Pivka'), (6258, 'Prestranek'), (6271, 'Dekani'), (6272, 'Gračišče'), (6273, 'Marezige'), (6274, 'Šmarje'), (6275, 'Črni Kal'), (6276, 'Pobegi'), (6280, 'Ankaran - Ancarano'), (6281, 'Škofije'), (6310, 'Izola - Isola'), (6320, 'Portorož - Portorose'), (6330, 'Piran - Pirano'), (6333, 'Sečovlje - Sicciole'), (8000, 'Novo mesto'), (8210, 'Trebnje'), (8211, 'Dobrnič'), (8212, 'Velika Loka'), (8213, 'Veliki Gaber'), (8216, 'Mirna Peč'), (8220, 'Šmarješke Toplice'), (8222, 'Otočec'), (8230, 'Mokronog'), (8231, 'Trebelno'), (8232, 'Šentrupert'), (8233, 'Mirna'), (8250, 'Brežice'), (8251, 'Čatež ob Savi'), (8253, 'Artiče'), (8254, 'Globoko'), (8255, 'Pišece'), (8256, 'Sromlje'), (8257, 'Dobova'), (8258, 'Kapele'), (8259, 'Bizeljsko'), (8261, 'Jesenice na Dolenjskem'), (8262, 'Krška vas'), (8263, 'Cerklje ob Krki'), (8270, 'Krško'), (8272, 'Zdole'), (8273, 'Leskovec pri Krškem'), (8274, 'Raka'), (8275, 'Škocjan'), (8276, 'Bučka'), (8280, 'Brestanica'), (8281, 'Senovo'), (8282, 'Koprivnica'), (8283, 'Blanca'), (8290, 'Sevnica'), (8292, 'Zabukovje'), (8293, 'Studenec'), (8294, 'Boštanj'), (8295, 'Tržišče'), (8296, 'Krmelj'), (8297, 'Šentjanž'), (8310, 'Šentjernej'), (8311, 'Kostanjevica na Krki'), (8312, 'Podbočje'), (8321, 'Brusnice'), (8322, 'Stopiče'), (8323, 'Uršna sela'), (8330, 'Metlika'), (8331, 'Suhor'), (8332, 'Gradac'), (8333, 'Semič'), (8340, 'Črnomelj'), (8341, 'Adlešiči'), (8342, 'Stari trg ob Kolpi'), (8343, 'Dragatuš'), (8344, 'Vinica pri Črnomlju'), (8350, 'Dolenjske Toplice'), (8351, 'Straža'), (8360, 'Žužemberk'), (8361, 'Dvor'), (8362, 'Hinje'), (9000, 'Murska Sobota'), (9201, 'Puconci'), (9202, 'Mačkovci'), (9203, 'Petrovci'), (9204, 'Šalovci'), (9205, 'Hodoš - Hodos'), (9206, 'Križevci'), (9207, 'Prosenjakovci - Partosfalva'), (9208, 'Fokovci'), (9220, 'Lendava - Lendva'), (9221, 'Martjanci'), (9222, 'Bogojina'), (9223, 'Dobrovnik - Dobronak'), (9224, 'Turnišče'), (9225, 'Velika Polana'), (9226, 'Moravske Toplice'), (9227, 'Kobilje'), (9231, 'Beltinci'), (9232, 'Črenšovci'), (9233, 'Odranci'), (9240, 'Ljutomer'), (9241, 'Veržej'), (9242, 'Križevci pri Ljutomeru'), (9243, 'Mala Nedelja'), (9244, 'Sveti Jurij ob Ščavnici'), (9245, 'Spodnji Ivanjci'), (9250, 'Gornja Radgona'), (9251, 'Tišina'), (9252, 'Radenci'), (9253, 'Apače'), (9261, 'Cankova'), (9262, 'Rogašovci'), (9263, 'Kuzma'), (9264, 'Grad'), (9265, 'Bodonci')]

A list of Slovenian postal codes

Slovakia (sk)

Forms

Slovak-specific form helpers.

class localflavor.sk.forms.SKDistrictSelect(attrs=None)[source]

A select widget with list of Slovak districts as choices.

class localflavor.sk.forms.SKPostalCodeField(**kwargs)[source]

A form field that validates its input as Slovak postal code.

Valid form is XXXXX or XXX XX, where X represents integer.

clean(value)[source]

Validates the input and returns a string that contains only numbers.

Returns an empty string for empty values.

class localflavor.sk.forms.SKRegionSelect(attrs=None)[source]

A select widget widget with list of Slovak regions as choices.

Data

localflavor.sk.sk_districts.DISTRICT_CHOICES = (('BB', 'Banska Bystrica'), ('BS', 'Banska Stiavnica'), ('BJ', 'Bardejov'), ('BN', 'Banovce nad Bebravou'), ('BR', 'Brezno'), ('BA1', 'Bratislava I'), ('BA2', 'Bratislava II'), ('BA3', 'Bratislava III'), ('BA4', 'Bratislava IV'), ('BA5', 'Bratislava V'), ('BY', 'Bytca'), ('CA', 'Cadca'), ('DT', 'Detva'), ('DK', 'Dolny Kubin'), ('DS', 'Dunajska Streda'), ('GA', 'Galanta'), ('GL', 'Gelnica'), ('HC', 'Hlohovec'), ('HE', 'Humenne'), ('IL', 'Ilava'), ('KK', 'Kezmarok'), ('KN', 'Komarno'), ('KE1', 'Kosice I'), ('KE2', 'Kosice II'), ('KE3', 'Kosice III'), ('KE4', 'Kosice IV'), ('KEO', 'Kosice - okolie'), ('KA', 'Krupina'), ('KM', 'Kysucke Nove Mesto'), ('LV', 'Levice'), ('LE', 'Levoca'), ('LM', 'Liptovsky Mikulas'), ('LC', 'Lucenec'), ('MA', 'Malacky'), ('MT', 'Martin'), ('ML', 'Medzilaborce'), ('MI', 'Michalovce'), ('MY', 'Myjava'), ('NO', 'Namestovo'), ('NR', 'Nitra'), ('NM', 'Nove Mesto nad Vahom'), ('NZ', 'Nove Zamky'), ('PE', 'Partizanske'), ('PK', 'Pezinok'), ('PN', 'Piestany'), ('PT', 'Poltar'), ('PP', 'Poprad'), ('PB', 'Povazska Bystrica'), ('PO', 'Presov'), ('PD', 'Prievidza'), ('PU', 'Puchov'), ('RA', 'Revuca'), ('RS', 'Rimavska Sobota'), ('RV', 'Roznava'), ('RK', 'Ruzomberok'), ('SB', 'Sabinov'), ('SC', 'Senec'), ('SE', 'Senica'), ('SI', 'Skalica'), ('SV', 'Snina'), ('SO', 'Sobrance'), ('SN', 'Spisska Nova Ves'), ('SL', 'Stara Lubovna'), ('SP', 'Stropkov'), ('SK', 'Svidnik'), ('SA', 'Sala'), ('TO', 'Topolcany'), ('TV', 'Trebisov'), ('TN', 'Trencin'), ('TT', 'Trnava'), ('TR', 'Turcianske Teplice'), ('TS', 'Tvrdosin'), ('VK', 'Velky Krtis'), ('VT', 'Vranov nad Toplou'), ('ZM', 'Zlate Moravce'), ('ZV', 'Zvolen'), ('ZC', 'Zarnovica'), ('ZH', 'Ziar nad Hronom'), ('ZA', 'Zilina'))

http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska

localflavor.sk.sk_regions.REGION_CHOICES = (('BB', 'Banska Bystrica region'), ('BA', 'Bratislava region'), ('KE', 'Kosice region'), ('NR', 'Nitra region'), ('PO', 'Presov region'), ('TN', 'Trencin region'), ('TT', 'Trnava region'), ('ZA', 'Zilina region'))

http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska

Tunisia (tn)

Tunisia-specific Form helpers.

class localflavor.tn.forms.TNGovernorateSelect(attrs=None)[source]

A Select widget that uses a list of the Tunisian governorates as its choices.

localflavor.tn.tn_governorates.GOVERNORATE_CHOICES = (('ariana', 'Ariana'), ('beja', 'Beja'), ('ben arous', 'Ben Arous'), ('bizert', 'Bizert'), ('gabes', 'Gabes'), ('gafsa', 'Gafsa'), ('jendouba', 'Jendouba'), ('kairouan', 'Kairouan'), ('kasserine', 'Kasserine'), ('kebili', 'Kebili'), ('kef', 'Kef'), ('mahdia', 'Mahdia'), ('manouba', 'Manouba'), ('medenine', 'Medenine'), ('monastir', 'Monastir'), ('nabeul', 'Nabeul'), ('sfax', 'Sfax'), ('sidi bouzid', 'Sidi Bouzid'), ('siliana', 'Siliana'), ('sousse', 'Sousse'), ('tataouine', 'Tataouine'), ('tozeur', 'Tozeur'), ('tunis', 'Tunis'), ('zaghouan', 'Zaghouan'))

All the 24 Tunisian Governorates http://en.wikipedia.org/wiki/Governorates_of_Tunisia

Turkey (tr)

Forms

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

A Turkey Identification Number number.

See: http://tr.wikipedia.org/wiki/T%C3%BCrkiye_Cumhuriyeti_Kimlik_Numaras%C4%B1

Checks the following rules to determine whether the number is valid:

  • The number is 11-digits.
  • First digit is not 0.
  • Conforms to the following two formula: (sum(1st, 3rd, 5th, 7th, 9th)*7 - sum(2nd,4th,6th,8th)) % 10 = 10th digit sum(1st to 10th) % 10 = 11th digit
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.tr.forms.TRPostalCodeField(max_length=5, min_length=5, **kwargs)[source]

A form field that validates input as a Turkish zip code.

Valid codes consist of five digits.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.tr.forms.TRProvinceSelect(attrs=None)[source]

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

Data

localflavor.tr.tr_provinces.PROVINCE_CHOICES = (('01', 'Adana'), ('02', 'Adıyaman'), ('03', 'Afyonkarahisar'), ('04', 'Ağrı'), ('68', 'Aksaray'), ('05', 'Amasya'), ('06', 'Ankara'), ('07', 'Antalya'), ('75', 'Ardahan'), ('08', 'Artvin'), ('09', 'Aydın'), ('10', 'Balıkesir'), ('74', 'Bartın'), ('72', 'Batman'), ('69', 'Bayburt'), ('11', 'Bilecik'), ('12', 'Bingöl'), ('13', 'Bitlis'), ('14', 'Bolu'), ('15', 'Burdur'), ('16', 'Bursa'), ('17', 'Çanakkale'), ('18', 'Çankırı'), ('19', 'Çorum'), ('20', 'Denizli'), ('21', 'Diyarbakır'), ('81', 'Düzce'), ('22', 'Edirne'), ('23', 'Elazığ'), ('24', 'Erzincan'), ('25', 'Erzurum'), ('26', 'Eskişehir'), ('27', 'Gaziantep'), ('28', 'Giresun'), ('29', 'Gümüşhane'), ('30', 'Hakkari'), ('31', 'Hatay'), ('76', 'Iğdır'), ('32', 'Isparta'), ('33', 'Mersin'), ('34', 'İstanbul'), ('35', 'İzmir'), ('78', 'Karabük'), ('36', 'Kars'), ('37', 'Kastamonu'), ('38', 'Kayseri'), ('39', 'Kırklareli'), ('40', 'Kırşehir'), ('41', 'Kocaeli'), ('42', 'Konya'), ('43', 'Kütahya'), ('44', 'Malatya'), ('45', 'Manisa'), ('46', 'Kahramanmaraş'), ('70', 'Karaman'), ('71', 'Kırıkkale'), ('79', 'Kilis'), ('47', 'Mardin'), ('48', 'Muğla'), ('49', 'Muş'), ('50', 'Nevşehir'), ('51', 'Niğde'), ('52', 'Ordu'), ('80', 'Osmaniye'), ('53', 'Rize'), ('54', 'Sakarya'), ('55', 'Samsun'), ('56', 'Siirt'), ('57', 'Sinop'), ('58', 'Sivas'), ('73', 'Şırnak'), ('59', 'Tekirdağ'), ('60', 'Tokat'), ('61', 'Trabzon'), ('62', 'Tunceli'), ('63', 'Şanlıurfa'), ('64', 'Uşak'), ('65', 'Van'), ('77', 'Yalova'), ('66', 'Yozgat'), ('67', 'Zonguldak'))

A list of Turkish provinces

Ukraine (ua)

Forms

class localflavor.ua.forms.UAPostalCodeField(**kwargs)[source]

A form field that validates input as a Ukrainian postal code.

Valid format is XXXXX. Note: first two numbers cannot be ‘00’.

Whitespace around a postal code is accepted and automatically trimmed.

New in version 1.5.

to_python(value)[source]

Return a string.

class localflavor.ua.forms.UARegionSelect(*args, **kwargs)[source]

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

New in version 1.5.

class localflavor.ua.forms.UAVatNumberField(**kwargs)[source]

A form field that validates input as a Ukrainian analog of a VAT number.

Valid format is XXXXXXXXXX.

Whitespace around a VAT number is accepted and automatically trimmed.

New in version 1.5.

to_python(value)[source]

Return a string.

Models

class localflavor.ua.models.UAPostalCodeField(*args, **kwargs)[source]

A model field which stores a Ukrainian postal code.

This field is represented by forms as a UAPostalCodeField field.

New in version 1.5.

class localflavor.ua.models.UARegionField(*args, **kwargs)[source]

A model field which stores a Ukrainian region.

This field is represented by forms as a UARegionSelect field.

New in version 1.5.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

class localflavor.ua.models.UAVatNumberField(*args, **kwargs)[source]

A model field which stores a Ukrainian analog of a VAT number.

This field is represented by forms as a UAVatNumberField field.

New in version 1.5.

Data

localflavor.ua.ua_regions.UA_REGION_CHOICES = (('UA-71', 'Cherkasy Oblast'), ('UA-74', 'Chernihiv Oblast'), ('UA-77', 'Chernivtsi Oblast'), ('UA-12', 'Dnipropetrovsk Oblast'), ('UA-14', 'Donetsk Oblast'), ('UA-26', 'Ivano-Frankivsk Oblast'), ('UA-63', 'Kharkiv Oblast'), ('UA-65', 'Kherson Oblast'), ('UA-68', 'Khmelnytskyi Oblast'), ('UA-35', 'Kirovohrad Oblast'), ('UA-32', 'Kiev Oblast'), ('UA-09', 'Luhansk Oblast'), ('UA-46', 'Lviv Oblast'), ('UA-48', 'Mykolaiv Oblast'), ('UA-51', 'Odessa Oblast'), ('UA-53', 'Poltava Oblast'), ('UA-56', 'Rivne Oblast'), ('UA-59', 'Sumy Oblast'), ('UA-61', 'Ternopil Oblast'), ('UA-05', 'Vinnytsia Oblast'), ('UA-07', 'Volyn Oblast'), ('UA-21', 'Zakarpattia Oblast'), ('UA-23', 'Zaporizhia Oblast'), ('UA-18', 'Zhytomyr Oblast'), ('UA-43', 'Autonomous Republic of Crimea'), ('UA-30', 'Kiev'), ('UA-40', 'Sevastopol'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

United States of America (us)

Forms

USA-specific Form helpers.

class localflavor.us.forms.USPSSelect(attrs=None)[source]

A Select widget that uses a list of US Postal Service codes as its choices.

Note

If you are looking for a form field that validates U.S. ZIP codes please use USZipCodeField.

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

A United States Social Security number.

Checks the following rules to determine whether the number is valid:

  • Conforms to the XXX-XX-XXXX format.
  • No group consists entirely of zeroes.
  • The leading group is not “666” (block “666” will never be allocated).
  • The number is not in the promotional block 987-65-4320 through 987-65-4329, which are permanently invalid.
  • The number is not one known to be invalid due to otherwise widespread promotional use or distribution (e.g., the Woolworth’s number or the 1962 promotional number).

New in version 1.1.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

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

A form field that validates its input is a U.S. state, territory, or COFA territory. The input is validated against a dictionary which includes names and abbreviations.

It normalizes the input to the standard two-letter postal service abbreviation for the given state.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.us.forms.USStateSelect(attrs=None)[source]

A Select widget that uses a list of U.S. states/territories as its choices.

class localflavor.us.forms.USZipCodeField(**kwargs)[source]

A form field that validates input as a U.S. ZIP code.

Valid formats are XXXXX or XXXXX-XXXX.

Note

If you are looking for a form field with a list of U.S. Postal Service locations please use USPSSelect.

New in version 1.1.

Whitespace around the ZIP code is accepted and automatically trimmed.

to_python(value)[source]

Return a string.

Models

class localflavor.us.models.USPostalCodeField(*args, **kwargs)[source]

A model field that stores the two-letter U.S. Postal Service abbreviation in the database.

Forms represent it as a USPSSelect` field.

Note

If you are looking for a model field that validates U.S. ZIP codes please use USZipCodeField.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

class localflavor.us.models.USSocialSecurityNumberField(*args, **kwargs)[source]

A model field that stores the security number in the format XXX-XX-XXXX.

Forms represent it as forms.USSocialSecurityNumberField field.

New in version 1.1.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class localflavor.us.models.USStateField(*args, **kwargs)[source]

A model field that stores the two-letter U.S. state abbreviation in the database.

Forms represent it as a forms.USStateField field.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

class localflavor.us.models.USZipCodeField(*args, **kwargs)[source]

A model field that stores the U.S. ZIP code in the database.

Forms represent it as a USZipCodeField field.

Note

If you are looking for a model field with a list of U.S. Postal Service locations please use USPostalCodeField.

New in version 1.1.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

Data

localflavor.us.us_states.CONTIGUOUS_STATES = (('AL', 'Alabama'), ('AZ', 'Arizona'), ('AR', 'Arkansas'), ('CA', 'California'), ('CO', 'Colorado'), ('CT', 'Connecticut'), ('DE', 'Delaware'), ('DC', 'District of Columbia'), ('FL', 'Florida'), ('GA', 'Georgia'), ('ID', 'Idaho'), ('IL', 'Illinois'), ('IN', 'Indiana'), ('IA', 'Iowa'), ('KS', 'Kansas'), ('KY', 'Kentucky'), ('LA', 'Louisiana'), ('ME', 'Maine'), ('MD', 'Maryland'), ('MA', 'Massachusetts'), ('MI', 'Michigan'), ('MN', 'Minnesota'), ('MS', 'Mississippi'), ('MO', 'Missouri'), ('MT', 'Montana'), ('NE', 'Nebraska'), ('NV', 'Nevada'), ('NH', 'New Hampshire'), ('NJ', 'New Jersey'), ('NM', 'New Mexico'), ('NY', 'New York'), ('NC', 'North Carolina'), ('ND', 'North Dakota'), ('OH', 'Ohio'), ('OK', 'Oklahoma'), ('OR', 'Oregon'), ('PA', 'Pennsylvania'), ('RI', 'Rhode Island'), ('SC', 'South Carolina'), ('SD', 'South Dakota'), ('TN', 'Tennessee'), ('TX', 'Texas'), ('UT', 'Utah'), ('VT', 'Vermont'), ('VA', 'Virginia'), ('WA', 'Washington'), ('WV', 'West Virginia'), ('WI', 'Wisconsin'), ('WY', 'Wyoming'))

The 48 contiguous states, plus the District of Columbia.

localflavor.us.us_states.NON_CONTIGUOUS_STATES = (('AK', 'Alaska'), ('HI', 'Hawaii'))

Non contiguous states (Not connected to mainland USA)

localflavor.us.us_states.US_TERRITORIES = (('AS', 'American Samoa'), ('GU', 'Guam'), ('MP', 'Northern Mariana Islands'), ('PR', 'Puerto Rico'), ('VI', 'Virgin Islands'))

Non-state territories.

localflavor.us.us_states.ARMED_FORCES_STATES = (('AA', 'Armed Forces Americas'), ('AE', 'Armed Forces Europe'), ('AP', 'Armed Forces Pacific'))

Military postal “states”. Note that ‘AE’ actually encompasses Europe, Canada, Africa and the Middle East.

localflavor.us.us_states.COFA_STATES = (('FM', 'Federated States of Micronesia'), ('MH', 'Marshall Islands'), ('PW', 'Palau'))

Non-US locations serviced by USPS (under Compact of Free Association).

localflavor.us.us_states.OBSOLETE_STATES = (('CM', 'Commonwealth of the Northern Mariana Islands'), ('CZ', 'Panama Canal Zone'), ('PI', 'Philippine Islands'), ('TT', 'Trust Territory of the Pacific Islands'))

Obsolete abbreviations (no longer US territories/USPS service, or code changed).

localflavor.us.us_states.US_STATES = CONTIGUOUS_STATES + NON_CONTIGUOUS_STATES

All US states.

This tuple is lazily generated and may not work as expected in all cases due to tuple optimizations in the Python interpreter which do not account for lazily generated tuples. For example:

US_STATES + ('XX', _('Select a State'))

should work as expected, but:

('XX', _('Select a State')) + US_STATES

may throw:

TypeError: can only concatenate tuple (not "proxy") to tuple

due to a Python optimization that causes the concatenation to occur before US_STATES has been lazily generated. To work around these issues, you can use a slice index ([:]) to force the generation of US_STATES before any other operations are processed by the Python interpreter:

('XX', _('Select a State')) + US_STATES[:]
localflavor.us.us_states.STATE_CHOICES = CONTIGUOUS_STATES + NON_CONTIGUOUS_STATES + US_TERRITORIES + ARMED_FORCES_STATES

All US states and territories plus DC and military mail.

This tuple is lazily generated and may not work as expected in all cases due to tuple optimizations in the Python interpreter which do not account for lazily generated tuples. For example:

STATE_CHOICES + ('XX', _('Select a State'))

should work as expected, but:

('XX', _('Select a State')) + STATE_CHOICES

may throw:

TypeError: can only concatenate tuple (not "proxy") to tuple

due to a Python optimization that causes the concatenation to occur before STATE_CHOICES has been lazily generated. To work around these issues, you can use a slice index ([:]) to force the generation of STATE_CHOICES before any other operations are processed by the Python interpreter:

('XX', _('Select a State')) + STATE_CHOICES[:]
localflavor.us.us_states.USPS_CHOICES = CONTIGUOUS_STATES + NON_CONTIGUOUS_STATES + US_TERRITORIES + ARMED_FORCES_STATES + COFA_STATES

All US Postal Service locations.

This tuple is lazily generated and may not work as expected in all cases due to tuple optimizations in the Python interpreter which do not account for lazily generated tuples. For example:

USPS_CHOICES + ('XX', _('Select a State'))

should work as expected, but:

('XX', _('Select a State')) + USPS_CHOICES

may throw:

TypeError: can only concatenate tuple (not "proxy") to tuple

due to a Python optimization that causes the concatenation to occur before USPS_CHOICES has been lazily generated. To work around these issues, you can use a slice index ([:]) to force the generation of USPS_CHOICES before any other operations are processed by the Python interpreter:

('XX', _('Select a State')) + USPS_CHOICES[:]
localflavor.us.us_states.STATES_NORMALIZED = {'aa': 'AA', 'ae': 'AE', 'ak': 'AK', 'al': 'AL', 'ala': 'AL', 'alabama': 'AL', 'alaska': 'AK', 'american samao': 'AS', 'american samoa': 'AS', 'ap': 'AP', 'ar': 'AR', 'ariz': 'AZ', 'arizona': 'AZ', 'ark': 'AR', 'arkansas': 'AR', 'as': 'AS', 'az': 'AZ', 'ca': 'CA', 'calf': 'CA', 'calif': 'CA', 'california': 'CA', 'co': 'CO', 'colo': 'CO', 'colorado': 'CO', 'conn': 'CT', 'connecticut': 'CT', 'ct': 'CT', 'dc': 'DC', 'de': 'DE', 'del': 'DE', 'delaware': 'DE', 'deleware': 'DE', 'district of columbia': 'DC', 'federated states of micronesia': 'FM', 'fl': 'FL', 'fla': 'FL', 'florida': 'FL', 'fm': 'FM', 'fsm': 'FM', 'ga': 'GA', 'georgia': 'GA', 'gu': 'GU', 'guam': 'GU', 'hawaii': 'HI', 'hi': 'HI', 'ia': 'IA', 'id': 'ID', 'idaho': 'ID', 'il': 'IL', 'ill': 'IL', 'illinois': 'IL', 'in': 'IN', 'ind': 'IN', 'indiana': 'IN', 'iowa': 'IA', 'kan': 'KS', 'kans': 'KS', 'kansas': 'KS', 'kentucky': 'KY', 'ks': 'KS', 'ky': 'KY', 'la': 'LA', 'louisiana': 'LA', 'ma': 'MA', 'maine': 'ME', 'marianas islands': 'MP', 'marianas islands of the pacific': 'MP', 'marinas islands of the pacific': 'MP', 'marshall islands': 'MH', 'maryland': 'MD', 'mass': 'MA', 'massachusetts': 'MA', 'massachussetts': 'MA', 'md': 'MD', 'me': 'ME', 'mh': 'MH', 'mi': 'MI', 'mich': 'MI', 'michigan': 'MI', 'micronesia': 'FM', 'minn': 'MN', 'minnesota': 'MN', 'miss': 'MS', 'mississippi': 'MS', 'missouri': 'MO', 'mn': 'MN', 'mo': 'MO', 'mont': 'MT', 'montana': 'MT', 'mp': 'MP', 'ms': 'MS', 'mt': 'MT', 'n d': 'ND', 'n dak': 'ND', 'n h': 'NH', 'n j': 'NJ', 'n m': 'NM', 'n mex': 'NM', 'nc': 'NC', 'nd': 'ND', 'ne': 'NE', 'neb': 'NE', 'nebr': 'NE', 'nebraska': 'NE', 'nev': 'NV', 'nevada': 'NV', 'new hampshire': 'NH', 'new jersey': 'NJ', 'new mexico': 'NM', 'new york': 'NY', 'nh': 'NH', 'nj': 'NJ', 'nm': 'NM', 'nmex': 'NM', 'north carolina': 'NC', 'north dakota': 'ND', 'northern mariana islands': 'MP', 'nv': 'NV', 'ny': 'NY', 'oh': 'OH', 'ohio': 'OH', 'ok': 'OK', 'okla': 'OK', 'oklahoma': 'OK', 'or': 'OR', 'ore': 'OR', 'oreg': 'OR', 'oregon': 'OR', 'pa': 'PA', 'palau': 'PW', 'penn': 'PA', 'pennsylvania': 'PA', 'pr': 'PR', 'puerto rico': 'PR', 'pw': 'PW', 'republic of palau': 'PW', 'republic of the marshall islands': 'MH', 'rhode island': 'RI', 'ri': 'RI', 's dak': 'SD', 'sc': 'SC', 'sd': 'SD', 'sdak': 'SD', 'south carolina': 'SC', 'south dakota': 'SD', 'tenn': 'TN', 'tennessee': 'TN', 'territory of hawaii': 'HI', 'tex': 'TX', 'texas': 'TX', 'tn': 'TN', 'tx': 'TX', 'us virgin islands': 'VI', 'usvi': 'VI', 'ut': 'UT', 'utah': 'UT', 'va': 'VA', 'vermont': 'VT', 'vi': 'VI', 'viginia': 'VA', 'virgin islands': 'VI', 'virgina': 'VA', 'virginia': 'VA', 'vt': 'VT', 'w va': 'WV', 'wa': 'WA', 'wash': 'WA', 'washington': 'WA', 'west virginia': 'WV', 'wi': 'WI', 'wis': 'WI', 'wisc': 'WI', 'wisconsin': 'WI', 'wv': 'WV', 'wva': 'WV', 'wy': 'WY', 'wyo': 'WY', 'wyoming': 'WY'}

Normalized versions of state names

Uruguay (uy)

Forms

UY-specific form helpers.

class localflavor.uy.forms.UYCIField(**kwargs)[source]

A field that validates Uruguayan ‘Cedula de identidad’ (CI) numbers.

clean(value)[source]

Validates format and validation digit.

The official format is [X.]XXX.XXX-X but usually dots and/or slash are omitted so, when validating, those characters are ignored if found in the correct place. The three typically used formats are supported: [X]XXXXXXX, [X]XXXXXX-X and [X.]XXX.XXX-X.

class localflavor.uy.forms.UYDepartmentSelect(attrs=None)[source]

A Select widget that uses a list of Uruguayan departments as its choices.

Utilities

localflavor.uy.util.get_validation_digit(number)[source]

Calculates the validation digit for the given number.

Data

localflavor.uy.uy_departments.DEPARTMENT_CHOICES = (('G', 'Artigas'), ('A', 'Canelones'), ('E', 'Cerro Largo'), ('L', 'Colonia'), ('Q', 'Durazno'), ('N', 'Flores'), ('O', 'Florida'), ('P', 'Lavalleja'), ('B', 'Maldonado'), ('S', 'Montevideo'), ('I', 'Paysandú'), ('J', 'Río Negro'), ('F', 'Rivera'), ('C', 'Rocha'), ('H', 'Salto'), ('M', 'San José'), ('K', 'Soriano'), ('R', 'Tacuarembó'), ('D', 'Treinta y Tres'))

A list of Uruguayan departments as choices in a formfield.

South Africa (za)

Forms

South Africa-specific Form helpers.

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

A form field for South African ID numbers.

The checksum is validated using the Luhn checksum, and uses a simplistic (read: not entirely accurate) check for the birth date.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.za.forms.ZAPostCodeField(**kwargs)[source]

A form field that validates input as a South African postcode.

Valid postcodes must have four digits.

class localflavor.za.forms.ZAProvinceSelect(attrs=None)[source]

A Select widget that uses a list of South African Provinces as its choices.

Data

localflavor.za.za_provinces.PROVINCE_CHOICES = (('EC', 'Eastern Cape'), ('FS', 'Free State'), ('GP', 'Gauteng'), ('KN', 'KwaZulu-Natal'), ('LP', 'Limpopo'), ('MP', 'Mpumalanga'), ('NC', 'Northern Cape'), ('NW', 'North West'), ('WC', 'Western Cape'))

A list of South African provinces as choices in a formfield.

Generic helpers

Forms

class localflavor.generic.forms.BICFormField(**kwargs)[source]

A BIC consists of 8 (BIC8) or 11 (BIC11) alphanumeric characters.

BICs are also known as SWIFT-BIC, BIC code, SWIFT ID, SWIFT code or ISO 9362.

https://en.wikipedia.org/wiki/ISO_9362

New in version 1.1.

to_python(value)[source]

Return a string.

class localflavor.generic.forms.DateField(input_formats=None, **kwargs)[source]

A date input field which uses non-US date input formats by default.

class localflavor.generic.forms.DateTimeField(input_formats=None, **kwargs)[source]

A date and time input field which uses non-US date and time input formats by default.

class localflavor.generic.forms.IBANFormField(use_nordea_extensions=False, include_countries=None, **kwargs)[source]

An IBAN consists of up to 34 alphanumeric characters.

To limit validation to specific countries, set the ‘include_countries’ argument with a tuple or list of ISO 3166-1 alpha-2 codes. For example, include_countries=(‘NL’, ‘BE, ‘LU’).

A list of countries that use IBANs as part of SEPA is included for convenience. To use this feature, set include_countries=IBAN_SEPA_COUNTRIES as an argument to the field.

Example:

from django import forms
from localflavor.generic.forms import IBANFormField
from localflavor.generic.countries.sepa import IBAN_SEPA_COUNTRIES

class MyForm(forms.Form):
    iban = IBANFormField(include_countries=IBAN_SEPA_COUNTRIES)

In addition to validating official IBANs, this field can optionally validate unofficial IBANs that have been catalogued by Nordea by setting the use_nordea_extensions argument to True.

https://en.wikipedia.org/wiki/International_Bank_Account_Number

New in version 1.1.

prepare_value(value)[source]

The display format for IBAN has a space every 4 characters.

to_python(value)[source]

Return a string.

class localflavor.generic.forms.SplitDateTimeField(input_date_formats=None, input_time_formats=None, **kwargs)[source]

Split date and time input fields which use non-US date and time input formats by default.

Models

class localflavor.generic.models.BICField(*args, **kwargs)[source]

A BIC consists of 8 (BIC8) or 11 (BIC11) alphanumeric characters.

BICs are also known as SWIFT-BIC, BIC code, SWIFT ID, SWIFT code or ISO 9362.

https://en.wikipedia.org/wiki/ISO_9362

New in version 1.1.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value)[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

class localflavor.generic.models.IBANField(*args, **kwargs)[source]

An IBAN consists of up to 34 alphanumeric characters.

To limit validation to specific countries, set the ‘include_countries’ argument with a tuple or list of ISO 3166-1 alpha-2 codes. For example, include_countries=(‘NL’, ‘BE, ‘LU’).

A list of countries that use IBANs as part of SEPA is included for convenience. To use this feature, set include_countries=IBAN_SEPA_COUNTRIES as an argument to the field.

Example:

from django.db import models
from localflavor.generic.models import IBANField
from localflavor.generic.countries.sepa import IBAN_SEPA_COUNTRIES

class MyModel(models.Model):
    iban = IBANField(include_countries=IBAN_SEPA_COUNTRIES)

In addition to validating official IBANs, this field can optionally validate unofficial IBANs that have been catalogued by Nordea by setting the use_nordea_extensions argument to True.

https://en.wikipedia.org/wiki/International_Bank_Account_Number

New in version 1.1.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

to_python(value)[source]

Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.

Validators

class localflavor.generic.validators.BICValidator[source]

A validator for SWIFT Business Identifier Codes (ISO 9362:2009).

Validation is based on the BIC structure found on wikipedia.

https://en.wikipedia.org/wiki/ISO_9362#Structure

deconstruct()

Return a 3-tuple of class import path, positional arguments, and keyword arguments.

class localflavor.generic.validators.EANValidator(strip_nondigits=False, message=None)[source]

A generic validator for EAN like codes with the last digit being the checksum.

http://en.wikipedia.org/wiki/International_Article_Number_(EAN)

deconstruct()

Return a 3-tuple of class import path, positional arguments, and keyword arguments.

class localflavor.generic.validators.IBANValidator(use_nordea_extensions=False, include_countries=None)[source]

A validator for International Bank Account Numbers (IBAN - ISO 13616-1:2007).

deconstruct()

Return a 3-tuple of class import path, positional arguments, and keyword arguments.

static iban_checksum(value)[source]

Returns check digits for an input IBAN number.

Original checksum in input value is ignored.

class localflavor.generic.validators.VATINValidator[source]

A validator for VAT identification numbers.

Currently only supports European VIES VAT identification numbers.

See See https://en.wikipedia.org/wiki/VAT_identification_number

clean(value)[source]

Return tuple of country code and number.

deconstruct()

Return a 3-tuple of class import path, positional arguments, and keyword arguments.

localflavor.generic.validators.VATIN_COUNTRY_CODE_LENGTH = 2

Length of the country code prefix of a VAT identification number.

Codes are two letter ISO 3166-1 alpha-2 codes except for Greece that uses ISO 639-1.

localflavor.generic.validators.VATIN_PATTERN_MAP = {'AT': '^ATU\\d{8}$', 'BE': '^BE0?\\d{9}$', 'BG': '^BG\\d{9,10}$', 'CY': '^CY\\d{8}[A-Z]$', 'CZ': '^CZ\\d{8,10}$', 'DE': '^DE\\d{9}$', 'DK': '^DK\\d{8}$', 'EE': '^EE\\d{9}$', 'EL': '^EL\\d{9}$', 'ES': '^ES[A-Z0-9]\\d{7}[A-Z0-9]$', 'FI': '^FI\\d{8}$', 'FR': '^FR[A-HJ-NP-Z0-9][A-HJ-NP-Z0-9]\\d{9}$', 'GB': '^(GB(GD|HA)\\d{3}|GB\\d{9}|GB\\d{12})$', 'HR': '^HR\\d{11}$', 'HU': '^HU\\d{8}$', 'IE': '^IE\\d[A-Z0-9\\+\\*]\\d{5}[A-Z]{1,2}$', 'IT': '^IT\\d{11}$', 'LT': '^LT(\\d{9}|\\d{12})$', 'LU': '^LU\\d{8}$', 'LV': '^LV\\d{11}$', 'MT': '^MT\\d{8}$', 'NL': '^NL\\d{9}B\\d{2}$', 'PL': '^PL\\d{10}$', 'PT': '^PT\\d{9}$', 'RO': '^RO\\d{2,10}$', 'SE': '^SE\\d{10}01$', 'SI': '^SI\\d{8}$', 'SK': '^SK\\d{10}$'}

Map of country codes and regular expressions.

See https://en.wikipedia.org/wiki/VAT_identification_number

New in version 1.1.

Data

localflavor.generic.countries.iso_3166.ISO_3166_1_ALPHA2_COUNTRY_CODES = ('AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JE', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW', 'XK')

ISO 3166-1 country list. Sourced from https://www.iso.org/obp/ui on 2014-11-08

localflavor.generic.countries.sepa.IBAN_SEPA_COUNTRIES = ('AD', 'AT', 'BE', 'BG', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GI', 'GR', 'HR', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MC', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'SM', 'VA')

European Payments Council list of SEPA scheme countries as of 2 Sep 2015. http://www.europeanpaymentscouncil.eu/index.cfm/knowledge-bank/epc-documents/epc-list-of-sepa-scheme-countries/