========================== The "local flavor" add-ons ========================== A collection of various Django snippets that are useful only for a particular country or culture. For example, ``django.contrib.localflavor.usa.forms`` contains a ``USZipCodeField`` that you can use to validate U.S. zip codes. These are mainly for newforms framework, to use these, just import the field you want, and use it in a form: from django import newforms as forms from django.contrib.localflavor import fr class MyForm(forms.Form): my_french_phone_no = fr.forms.FRPhoneNumberField() America (django.contrib.localflavor.usa) ======================================== USPhoneNumberField ------------------ A US Phone number field (XXX-XXX-XXXX format). USStateField ------------ A form field that validates its input is a U.S. state name or abbreviation. It normalizes the input to the standard two-leter postal service abbreviation for the given state. USStateSelect ------------- A form Select widget that uses a list of U.S. states/territories as its choices. USZipCodeField -------------- A field for US Zip codes, in the format XXXXX or XXXXX-XXXX. Britain (django.contrib.localflavor.uk) ======================================= UKPostcodeField --------------- 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 at http://www.govtalk.gov.uk/gdsc/schemas/bs7666-v2-0.xsd France (django.contrib.localflavor.fr) ====================================== FRPhoneNumberField ------------------ Validates local French phone numbers. The correct format is '0X XX XX XX XX'. '0X.XX.XX.XX.XX' and '0XXXXXXXXX' validate but are corrected to '0X XX XX XX XX'. FRDepartmentSelect ------------------ A Select widget with a full list of FR departments. FRZipCodeField -------------- A field for French zip codes in the format XXXXX. Japan (django.contrib.localflavor.jp) ===================================== JPPostalCodeField ----------------- A form field that validates its input is a Japanese postcode. Accepts 7 digits, with or without a hyphen. JPPrefectureSelect ------------------ A Select widget that uses a list of Japanese prefectures as its choices. Adding A Flavor =============== We'd love to add more of these to Django, so please create a ticket for anything that you've found useful. Please use unicode objects (u'mystring') for strings, rather than setting the encoding in the file (see any of the existing flavors for examples).