1 | ==========================
|
---|
2 | The "local flavor" add-ons
|
---|
3 | ==========================
|
---|
4 |
|
---|
5 | A collection of various Django snippets that are useful only for a particular
|
---|
6 | country or culture. For example, ``django.contrib.localflavor.usa.forms``
|
---|
7 | contains a ``USZipCodeField`` that you can use to validate U.S. zip codes.
|
---|
8 |
|
---|
9 | These are mainly for newforms framework, to use these, just import the field
|
---|
10 | you want, and use it in a form:
|
---|
11 |
|
---|
12 | from django import newforms as forms
|
---|
13 | from django.contrib.localflavor import fr
|
---|
14 |
|
---|
15 | class MyForm(forms.Form):
|
---|
16 | my_french_phone_no = fr.forms.FRPhoneNumberField()
|
---|
17 |
|
---|
18 |
|
---|
19 | America (django.contrib.localflavor.usa)
|
---|
20 | ========================================
|
---|
21 |
|
---|
22 | USPhoneNumberField
|
---|
23 | ------------------
|
---|
24 |
|
---|
25 | A US Phone number field (XXX-XXX-XXXX format).
|
---|
26 |
|
---|
27 | USStateField
|
---|
28 | ------------
|
---|
29 |
|
---|
30 | A form field that validates its input is a U.S. state name or abbreviation. It
|
---|
31 | normalizes the input to the standard two-leter postal service abbreviation for
|
---|
32 | the given state.
|
---|
33 |
|
---|
34 | USStateSelect
|
---|
35 | -------------
|
---|
36 |
|
---|
37 | A form Select widget that uses a list of U.S. states/territories as its choices.
|
---|
38 |
|
---|
39 | USZipCodeField
|
---|
40 | --------------
|
---|
41 |
|
---|
42 | A field for US Zip codes, in the format XXXXX or XXXXX-XXXX.
|
---|
43 |
|
---|
44 |
|
---|
45 | Britain (django.contrib.localflavor.uk)
|
---|
46 | =======================================
|
---|
47 |
|
---|
48 | UKPostcodeField
|
---|
49 | ---------------
|
---|
50 |
|
---|
51 | A form field that validates its input is a UK postcode. The regular expression used
|
---|
52 | is sourced from the schema for British Standard BS7666 address types at http://www.govtalk.gov.uk/gdsc/schemas/bs7666-v2-0.xsd
|
---|
53 |
|
---|
54 |
|
---|
55 | France (django.contrib.localflavor.fr)
|
---|
56 | ======================================
|
---|
57 |
|
---|
58 | FRPhoneNumberField
|
---|
59 | ------------------
|
---|
60 |
|
---|
61 | Validates local French phone numbers. The correct format is '0X XX XX XX XX'.
|
---|
62 | '0X.XX.XX.XX.XX' and '0XXXXXXXXX' validate but are corrected to '0X XX XX XX XX'.
|
---|
63 |
|
---|
64 | FRDepartmentSelect
|
---|
65 | ------------------
|
---|
66 |
|
---|
67 | A Select widget with a full list of FR departments.
|
---|
68 |
|
---|
69 | FRZipCodeField
|
---|
70 | --------------
|
---|
71 |
|
---|
72 | A field for French zip codes in the format XXXXX.
|
---|
73 |
|
---|
74 |
|
---|
75 | Japan (django.contrib.localflavor.jp)
|
---|
76 | =====================================
|
---|
77 |
|
---|
78 | JPPostalCodeField
|
---|
79 | -----------------
|
---|
80 |
|
---|
81 | A form field that validates its input is a Japanese postcode. Accepts 7 digits, with or without a hyphen.
|
---|
82 |
|
---|
83 | JPPrefectureSelect
|
---|
84 | ------------------
|
---|
85 |
|
---|
86 | A Select widget that uses a list of Japanese prefectures as its choices.
|
---|
87 |
|
---|
88 |
|
---|
89 | Adding A Flavor
|
---|
90 | ===============
|
---|
91 |
|
---|
92 | We'd love to add more of these to Django, so please create a ticket for anything
|
---|
93 | that you've found useful. Please use unicode objects (u'mystring') for strings,
|
---|
94 | rather than setting the encoding in the file (see any of the existing flavors for
|
---|
95 | examples).
|
---|
96 |
|
---|
97 |
|
---|