localflavor.txt 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. ==========================
  2. The "local flavor" add-ons
  3. ==========================
  4. .. module:: django.contrib.localflavor
  5. :synopsis: A collection of various Django snippets that are useful only for
  6. a particular country or culture.
  7. Following its "batteries included" philosophy, Django comes with assorted
  8. pieces of code that are useful for particular countries or cultures. These are
  9. called the "local flavor" add-ons and live in the
  10. :mod:`django.contrib.localflavor` package.
  11. Inside that package, country- or culture-specific code is organized into
  12. subpackages, named using `ISO 3166 country codes`_.
  13. Most of the ``localflavor`` add-ons are localized form components deriving
  14. from the :doc:`forms </topics/forms/index>` framework -- for example, a
  15. :class:`~django.contrib.localflavor.us.forms.USStateField` that knows how to
  16. validate U.S. state abbreviations, and a
  17. :class:`~django.contrib.localflavor.fi.forms.FISocialSecurityNumber` that
  18. knows how to validate Finnish social security numbers.
  19. To use one of these localized components, just import the relevant subpackage.
  20. For example, here's how you can create a form with a field representing a
  21. French telephone number::
  22. from django import forms
  23. from django.contrib.localflavor.fr.forms import FRPhoneNumberField
  24. class MyForm(forms.Form):
  25. my_french_phone_no = FRPhoneNumberField()
  26. Supported countries
  27. ===================
  28. Countries currently supported by :mod:`~django.contrib.localflavor` are:
  29. * Argentina_
  30. * Australia_
  31. * Austria_
  32. * Brazil_
  33. * Canada_
  34. * Chile_
  35. * Czech_
  36. * Finland_
  37. * France_
  38. * Germany_
  39. * Iceland_
  40. * India_
  41. * Indonesia_
  42. * Ireland_
  43. * Italy_
  44. * Japan_
  45. * Kuwait_
  46. * Mexico_
  47. * `The Netherlands`_
  48. * Norway_
  49. * Peru_
  50. * Poland_
  51. * Portugal_
  52. * Romania_
  53. * Slovakia_
  54. * `South Africa`_
  55. * Spain_
  56. * Sweden_
  57. * Switzerland_
  58. * `United Kingdom`_
  59. * `United States of America`_
  60. * Uruguay_
  61. The ``django.contrib.localflavor`` package also includes a ``generic`` subpackage,
  62. containing useful code that is not specific to one particular country or culture.
  63. Currently, it defines date, datetime and split datetime input fields based on
  64. those from :doc:`forms </topics/forms/index>`, but with non-US default formats.
  65. Here's an example of how to use them::
  66. from django import forms
  67. from django.contrib.localflavor import generic
  68. class MyForm(forms.Form):
  69. my_date_field = generic.forms.DateField()
  70. .. _ISO 3166 country codes: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
  71. .. _Argentina: `Argentina (ar)`_
  72. .. _Australia: `Australia (au)`_
  73. .. _Austria: `Austria (at)`_
  74. .. _Brazil: `Brazil (br)`_
  75. .. _Canada: `Canada (ca)`_
  76. .. _Chile: `Chile (cl)`_
  77. .. _Czech: `Czech (cz)`_
  78. .. _Finland: `Finland (fi)`_
  79. .. _France: `France (fr)`_
  80. .. _Germany: `Germany (de)`_
  81. .. _The Netherlands: `The Netherlands (nl)`_
  82. .. _Iceland: `Iceland (is\_)`_
  83. .. _India: `India (in\_)`_
  84. .. _Indonesia: `Indonesia (id)`_
  85. .. _Ireland: `Ireland (ie)`_
  86. .. _Italy: `Italy (it)`_
  87. .. _Japan: `Japan (jp)`_
  88. .. _Kuwait: `Kuwait (kw)`_
  89. .. _Mexico: `Mexico (mx)`_
  90. .. _Norway: `Norway (no)`_
  91. .. _Peru: `Peru (pe)`_
  92. .. _Poland: `Poland (pl)`_
  93. .. _Portugal: `Portugal (pt)`_
  94. .. _Romania: `Romania (ro)`_
  95. .. _Slovakia: `Slovakia (sk)`_
  96. .. _South Africa: `South Africa (za)`_
  97. .. _Spain: `Spain (es)`_
  98. .. _Sweden: `Sweden (se)`_
  99. .. _Switzerland: `Switzerland (ch)`_
  100. .. _United Kingdom: `United Kingdom (uk)`_
  101. .. _United States of America: `United States of America (us)`_
  102. .. _Uruguay: `Uruguay (uy)`_
  103. Adding flavors
  104. ==============
  105. We'd love to add more of these to Django, so please `create a ticket`_ with
  106. any code you'd like to contribute. One thing we ask is that you please use
  107. Unicode objects (``u'mystring'``) for strings, rather than setting the encoding
  108. in the file. See any of the existing flavors for examples.
  109. .. _create a ticket: http://code.djangoproject.com/simpleticket
  110. Argentina (``ar``)
  111. =============================================
  112. .. class:: ar.forms.ARPostalCodeField
  113. A form field that validates input as either a classic four-digit Argentinian
  114. postal code or a CPA_.
  115. .. _CPA: http://www.correoargentino.com.ar/consulta_cpa/home.php
  116. .. class:: ar.forms.ARDNIField
  117. A form field that validates input as a Documento Nacional de Identidad (DNI)
  118. number.
  119. .. class:: ar.forms.ARCUITField
  120. A form field that validates input as a Codigo Unico de Identificacion
  121. Tributaria (CUIT) number.
  122. .. class:: ar.forms.ARProvinceSelect
  123. A ``Select`` widget that uses a list of Argentina's provinces and autonomous
  124. cities as its choices.
  125. Australia (``au``)
  126. =============================================
  127. .. class:: au.forms.AUPostCodeField
  128. A form field that validates input as an Australian postcode.
  129. .. class:: au.forms.AUPhoneNumberField
  130. A form field that validates input as an Australian phone number. Valid numbers
  131. have ten digits.
  132. .. class:: au.forms.AUStateSelect
  133. A ``Select`` widget that uses a list of Australian states/territories as its
  134. choices.
  135. Austria (``at``)
  136. ================
  137. .. class:: at.forms.ATZipCodeField
  138. A form field that validates its input as an Austrian zip code.
  139. .. class:: at.forms.ATStateSelect
  140. A ``Select`` widget that uses a list of Austrian states as its choices.
  141. .. class:: at.forms.ATSocialSecurityNumberField
  142. A form field that validates its input as an Austrian social security number.
  143. Brazil (``br``)
  144. ===============
  145. .. class:: br.forms.BRPhoneNumberField
  146. A form field that validates input as a Brazilian phone number, with the format
  147. XX-XXXX-XXXX.
  148. .. class:: br.forms.BRZipCodeField
  149. A form field that validates input as a Brazilian zip code, with the format
  150. XXXXX-XXX.
  151. .. class:: br.forms.BRStateSelect
  152. A ``Select`` widget that uses a list of Brazilian states/territories as its
  153. choices.
  154. Canada (``ca``)
  155. ===============
  156. .. class:: ca.forms.CAPhoneNumberField
  157. A form field that validates input as a Canadian phone number, with the format
  158. XXX-XXX-XXXX.
  159. .. class:: ca.forms.CAPostalCodeField
  160. A form field that validates input as a Canadian postal code, with the format
  161. XXX XXX.
  162. .. class:: ca.forms.CAProvinceField
  163. A form field that validates input as a Canadian province name or abbreviation.
  164. .. class:: ca.forms.CASocialInsuranceNumberField
  165. A form field that validates input as a Canadian Social Insurance Number (SIN).
  166. A valid number must have the format XXX-XXX-XXX and pass a `Luhn mod-10
  167. checksum`_.
  168. .. _Luhn mod-10 checksum: http://en.wikipedia.org/wiki/Luhn_algorithm
  169. .. class:: ca.forms.CAProvinceSelect
  170. A ``Select`` widget that uses a list of Canadian provinces and territories as
  171. its choices.
  172. Chile (``cl``)
  173. ==============
  174. .. class:: cl.forms.CLRutField
  175. A form field that validates input as a Chilean national identification number
  176. ('Rol Unico Tributario' or RUT). The valid format is XX.XXX.XXX-X.
  177. .. class:: cl.forms.CLRegionSelect
  178. A ``Select`` widget that uses a list of Chilean regions (Regiones) as its
  179. choices.
  180. Czech (``cz``)
  181. ==============
  182. .. class:: cz.forms.CZPostalCodeField
  183. A form field that validates input as a Czech postal code. Valid formats
  184. are XXXXX or XXX XX, where X is a digit.
  185. .. class:: cz.forms.CZBirthNumberField
  186. A form field that validates input as a Czech Birth Number.
  187. A valid number must be in format XXXXXX/XXXX (slash is optional).
  188. .. class:: cz.forms.CZICNumberField
  189. A form field that validates input as a Czech IC number field.
  190. .. class:: cz.forms.CZRegionSelect
  191. A ``Select`` widget that uses a list of Czech regions as its choices.
  192. Finland (``fi``)
  193. ================
  194. .. class:: fi.forms.FISocialSecurityNumber
  195. A form field that validates input as a Finnish social security number.
  196. .. class:: fi.forms.FIZipCodeField
  197. A form field that validates input as a Finnish zip code. Valid codes
  198. consist of five digits.
  199. .. class:: fi.forms.FIMunicipalitySelect
  200. A ``Select`` widget that uses a list of Finnish municipalities as its
  201. choices.
  202. France (``fr``)
  203. ===============
  204. .. class:: fr.forms.FRPhoneNumberField
  205. A form field that validates input as a French local phone number. The
  206. correct format is 0X XX XX XX XX. 0X.XX.XX.XX.XX and 0XXXXXXXXX validate
  207. but are corrected to 0X XX XX XX XX.
  208. .. class:: fr.forms.FRZipCodeField
  209. A form field that validates input as a French zip code. Valid codes
  210. consist of five digits.
  211. .. class:: fr.forms.FRDepartmentSelect
  212. A ``Select`` widget that uses a list of French departments as its choices.
  213. Germany (``de``)
  214. ================
  215. .. class:: de.forms.DEIdentityCardNumberField
  216. A form field that validates input as a German identity card number
  217. (Personalausweis_). Valid numbers have the format
  218. XXXXXXXXXXX-XXXXXXX-XXXXXXX-X, with no group consisting entirely of zeroes.
  219. .. _Personalausweis: http://de.wikipedia.org/wiki/Personalausweis
  220. .. class:: de.forms.DEZipCodeField
  221. A form field that validates input as a German zip code. Valid codes
  222. consist of five digits.
  223. .. class:: de.forms.DEStateSelect
  224. A ``Select`` widget that uses a list of German states as its choices.
  225. The Netherlands (``nl``)
  226. ========================
  227. .. class:: nl.forms.NLPhoneNumberField
  228. A form field that validates input as a Dutch telephone number.
  229. .. class:: nl.forms.NLSofiNumberField
  230. A form field that validates input as a Dutch social security number
  231. (SoFI/BSN).
  232. .. class:: nl.forms.NLZipCodeField
  233. A form field that validates input as a Dutch zip code.
  234. .. class:: nl.forms.NLProvinceSelect
  235. A ``Select`` widget that uses a list of Dutch provinces as its list of
  236. choices.
  237. Iceland (``is_``)
  238. =================
  239. .. class:: is_.forms.ISIdNumberField
  240. A form field that validates input as an Icelandic identification number
  241. (kennitala). The format is XXXXXX-XXXX.
  242. .. class:: is_.forms.ISPhoneNumberField
  243. A form field that validates input as an Icelandtic phone number (seven
  244. digits with an optional hyphen or space after the first three digits).
  245. .. class:: is_.forms.ISPostalCodeSelect
  246. A ``Select`` widget that uses a list of Icelandic postal codes as its
  247. choices.
  248. India (``in_``)
  249. ===============
  250. .. class:: in.forms.INStateField
  251. A form field that validates input as an Indian state/territory name or
  252. abbreviation. Input is normalized to the standard two-letter vehicle
  253. registration abbreviation for the given state or territory.
  254. .. class:: in.forms.INZipCodeField
  255. A form field that validates input as an Indian zip code, with the
  256. format XXXXXXX.
  257. .. class:: in.forms.INStateSelect
  258. A ``Select`` widget that uses a list of Indian states/territories as its
  259. choices.
  260. Ireland (``ie``)
  261. ================
  262. .. class:: ie.forms.IECountySelect
  263. A ``Select`` widget that uses a list of Irish Counties as its choices.
  264. Indonesia (``id``)
  265. ==================
  266. .. class:: id.forms.IDPostCodeField
  267. A form field that validates input as an Indonesian post code field.
  268. .. class:: id.forms.IDProvinceSelect
  269. A ``Select`` widget that uses a list of Indonesian provinces as its choices.
  270. .. class:: id.forms.IDPhoneNumberField
  271. A form field that validates input as an Indonesian telephone number.
  272. .. class:: id.forms.IDLicensePlatePrefixSelect
  273. A ``Select`` widget that uses a list of Indonesian license plate
  274. prefix code as its choices.
  275. .. class:: id.forms.IDLicensePlateField
  276. A form field that validates input as an Indonesian vehicle license plate.
  277. .. class:: id.forms.IDNationalIdentityNumberField
  278. A form field that validates input as an Indonesian national identity
  279. number (`NIK`_/KTP). The output will be in the format of
  280. 'XX.XXXX.DDMMYY.XXXX'. Dots or spaces can be used in the input to break
  281. down the numbers.
  282. .. _NIK: http://en.wikipedia.org/wiki/Indonesian_identity_card
  283. Italy (``it``)
  284. ==============
  285. .. class:: it.forms.ITSocialSecurityNumberField
  286. A form field that validates input as an Italian social security number
  287. (`codice fiscale`_).
  288. .. _codice fiscale: http://www.agenziaentrate.it/ilwwcm/connect/Nsi/Servizi/Codice+fiscale+-+tessera+sanitaria/NSI+Informazioni+sulla+codificazione+delle+persone+fisiche
  289. .. class:: it.forms.ITVatNumberField
  290. A form field that validates Italian VAT numbers (partita IVA).
  291. .. class:: it.forms.ITZipCodeField
  292. A form field that validates input as an Italian zip code. Valid codes
  293. must have five digits.
  294. .. class:: it.forms.ITProvinceSelect
  295. A ``Select`` widget that uses a list of Italian provinces as its choices.
  296. .. class:: it.forms.ITRegionSelect
  297. A ``Select`` widget that uses a list of Italian regions as its choices.
  298. Japan (``jp``)
  299. ==============
  300. .. class:: jp.forms.JPPostalCodeField
  301. A form field that validates input as a Japanese postcode. It accepts seven
  302. digits, with or without a hyphen.
  303. .. class:: jp.forms.JPPrefectureSelect
  304. A ``Select`` widget that uses a list of Japanese prefectures as its choices.
  305. Kuwait (``kw``)
  306. ===============
  307. .. class:: kw.forms.KWCivilIDNumberField
  308. A form field that validates input as a Kuwaiti Civil ID number. A valid
  309. Civil ID number must obey the following rules:
  310. * The number consist of 12 digits.
  311. * The birthdate of the person is a valid date.
  312. * The calculated checksum equals to the last digit of the Civil ID.
  313. Mexico (``mx``)
  314. ===============
  315. .. class:: mx.forms.MXStateSelect
  316. A ``Select`` widget that uses a list of Mexican states as its choices.
  317. Norway (``no``)
  318. ===============
  319. .. class:: no.forms.NOSocialSecurityNumber
  320. A form field that validates input as a Norwegian social security number
  321. (personnummer_).
  322. .. _personnummer: http://no.wikipedia.org/wiki/Personnummer
  323. .. class:: no.forms.NOZipCodeField
  324. A form field that validates input as a Norwegian zip code. Valid codes
  325. have four digits.
  326. .. class:: no.forms.NOMunicipalitySelect
  327. A ``Select`` widget that uses a list of Norwegian municipalities (fylker) as
  328. its choices.
  329. Peru (``pe``)
  330. =============
  331. .. class:: pe.forms.PEDNIField
  332. A form field that validates input as a DNI (Peruvian national identity)
  333. number.
  334. .. class:: pe.forms.PERUCField
  335. A form field that validates input as an RUC (Registro Unico de
  336. Contribuyentes) number. Valid RUC numbers have 11 digits.
  337. .. class:: pe.forms.PEDepartmentSelect
  338. A ``Select`` widget that uses a list of Peruvian Departments as its choices.
  339. Poland (``pl``)
  340. ===============
  341. .. class:: pl.forms.PLPESELField
  342. A form field that validates input as a Polish national identification number
  343. (PESEL_).
  344. .. _PESEL: http://en.wikipedia.org/wiki/PESEL
  345. .. class:: pl.forms.PLREGONField
  346. A form field that validates input as a Polish National Official Business
  347. Register Number (REGON_), having either seven or nine digits. The checksum
  348. algorithm used for REGONs is documented at
  349. http://wipos.p.lodz.pl/zylla/ut/nip-rego.html.
  350. .. _REGON: http://www.stat.gov.pl/bip/regon_ENG_HTML.htm
  351. .. class:: pl.forms.PLPostalCodeField
  352. A form field that validates input as a Polish postal code. The valid format
  353. is XX-XXX, where X is a digit.
  354. .. class:: pl.forms.PLNIPField
  355. A form field that validates input as a Polish Tax Number (NIP). Valid
  356. formats are XXX-XXX-XX-XX or XX-XX-XXX-XXX. The checksum algorithm used
  357. for NIPs is documented at http://wipos.p.lodz.pl/zylla/ut/nip-rego.html.
  358. .. class:: pl.forms.PLCountySelect
  359. A ``Select`` widget that uses a list of Polish administrative units as its
  360. choices.
  361. .. class:: pl.forms.PLProvinceSelect
  362. A ``Select`` widget that uses a list of Polish voivodeships (administrative
  363. provinces) as its choices.
  364. Portugal (``pt``)
  365. =================
  366. .. class:: pt.forms.PTZipCodeField
  367. A form field that validates input as a Portuguese zip code.
  368. .. class:: pt.forms.PTPhoneNumberField
  369. A form field that validates input as a Portuguese phone number.
  370. Valid numbers have 9 digits (may include spaces) or start by 00
  371. or + (international).
  372. Romania (``ro``)
  373. ================
  374. .. class:: ro.forms.ROCIFField
  375. A form field that validates Romanian fiscal identification codes (CIF). The
  376. return value strips the leading RO, if given.
  377. .. class:: ro.forms.ROCNPField
  378. A form field that validates Romanian personal numeric codes (CNP).
  379. .. class:: ro.forms.ROCountyField
  380. A form field that validates its input as a Romanian county (judet) name or
  381. abbreviation. It normalizes the input to the standard vehicle registration
  382. abbreviation for the given county. This field will only accept names written
  383. with diacritics; consider using ROCountySelect as an alternative.
  384. .. class:: ro.forms.ROCountySelect
  385. A ``Select`` widget that uses a list of Romanian counties (judete) as its
  386. choices.
  387. .. class:: ro.forms.ROIBANField
  388. A form field that validates its input as a Romanian International Bank
  389. Account Number (IBAN). The valid format is ROXX-XXXX-XXXX-XXXX-XXXX-XXXX,
  390. with or without hyphens.
  391. .. class:: ro.forms.ROPhoneNumberField
  392. A form field that validates Romanian phone numbers, short special numbers
  393. excluded.
  394. .. class:: ro.forms.ROPostalCodeField
  395. A form field that validates Romanian postal codes.
  396. Slovakia (``sk``)
  397. =================
  398. .. class:: sk.forms.SKPostalCodeField
  399. A form field that validates input as a Slovak postal code. Valid formats
  400. are XXXXX or XXX XX, where X is a digit.
  401. .. class:: sk.forms.SKDistrictSelect
  402. A ``Select`` widget that uses a list of Slovak districts as its choices.
  403. .. class:: sk.forms.SKRegionSelect
  404. A ``Select`` widget that uses a list of Slovak regions as its choices.
  405. South Africa (``za``)
  406. =====================
  407. .. class:: za.forms.ZAIDField
  408. A form field that validates input as a South African ID number. Validation
  409. uses the Luhn checksum and a simplistic (i.e., not entirely accurate) check
  410. for birth date.
  411. .. class:: za.forms.ZAPostCodeField
  412. A form field that validates input as a South African postcode. Valid
  413. postcodes must have four digits.
  414. Spain (``es``)
  415. ==============
  416. .. class:: es.forms.ESIdentityCardNumberField
  417. A form field that validates input as a Spanish NIF/NIE/CIF (Fiscal
  418. Identification Number) code.
  419. .. class:: es.forms.ESCCCField
  420. A form field that validates input as a Spanish bank account number (Codigo
  421. Cuenta Cliente or CCC). A valid CCC number has the format
  422. EEEE-OOOO-CC-AAAAAAAAAA, where the E, O, C and A digits denote the entity,
  423. office, checksum and account, respectively. The first checksum digit
  424. validates the entity and office. The second checksum digit validates the
  425. account. It is also valid to use a space as a delimiter, or to use no
  426. delimiter.
  427. .. class:: es.forms.ESPhoneNumberField
  428. A form field that validates input as a Spanish phone number. Valid numbers
  429. have nine digits, the first of which is 6, 8 or 9.
  430. .. class:: es.forms.ESPostalCodeField
  431. A form field that validates input as a Spanish postal code. Valid codes
  432. have five digits, the first two being in the range 01 to 52, representing
  433. the province.
  434. .. class:: es.forms.ESProvinceSelect
  435. A ``Select`` widget that uses a list of Spanish provinces as its choices.
  436. .. class:: es.forms.ESRegionSelect
  437. A ``Select`` widget that uses a list of Spanish regions as its choices.
  438. Sweden (``se``)
  439. ===============
  440. .. class:: se.forms.SECountySelect
  441. A Select form widget that uses a list of the Swedish counties (län) as its
  442. choices.
  443. The cleaned value is the official county code -- see
  444. http://en.wikipedia.org/wiki/Counties_of_Sweden for a list.
  445. .. class:: se.forms.SEOrganisationNumber
  446. A form field that validates input as a Swedish organisation number
  447. (organisationsnummer).
  448. It accepts the same input as SEPersonalIdentityField (for sole
  449. proprietorships (enskild firma). However, co-ordination numbers are not
  450. accepted.
  451. It also accepts ordinary Swedish organisation numbers with the format
  452. NNNNNNNNNN.
  453. The return value will be YYYYMMDDXXXX for sole proprietors, and NNNNNNNNNN
  454. for other organisations.
  455. .. class:: se.forms.SEPersonalIdentityNumber
  456. A form field that validates input as a Swedish personal identity number
  457. (personnummer).
  458. The correct formats are YYYYMMDD-XXXX, YYYYMMDDXXXX, YYMMDD-XXXX,
  459. YYMMDDXXXX and YYMMDD+XXXX.
  460. A \+ indicates that the person is older than 100 years, which will be taken
  461. into consideration when the date is validated.
  462. The checksum will be calculated and checked. The birth date is checked
  463. to be a valid date.
  464. By default, co-ordination numbers (samordningsnummer) will be accepted. To
  465. only allow real personal identity numbers, pass the keyword argument
  466. coordination_number=False to the constructor.
  467. The cleaned value will always have the format YYYYMMDDXXXX.
  468. .. class:: se.forms.SEPostalCodeField
  469. A form field that validates input as a Swedish postal code (postnummer).
  470. Valid codes consist of five digits (XXXXX). The number can optionally be
  471. formatted with a space after the third digit (XXX XX).
  472. The cleaned value will never contain the space.
  473. Switzerland (``ch``)
  474. ====================
  475. .. class:: ch.forms.CHIdentityCardNumberField
  476. A form field that validates input as a Swiss identity card number.
  477. A valid number must confirm to the X1234567<0 or 1234567890 format and
  478. have the correct checksums -- see http://adi.kousz.ch/artikel/IDCHE.htm.
  479. .. class:: ch.forms.CHPhoneNumberField
  480. A form field that validates input as a Swiss phone number. The correct
  481. format is 0XX XXX XX XX. 0XX.XXX.XX.XX and 0XXXXXXXXX validate but are
  482. corrected to 0XX XXX XX XX.
  483. .. class:: ch.forms.CHZipCodeField
  484. A form field that validates input as a Swiss zip code. Valid codes
  485. consist of four digits.
  486. .. class:: ch.forms.CHStateSelect
  487. A ``Select`` widget that uses a list of Swiss states as its choices.
  488. United Kingdom (``uk``)
  489. =======================
  490. .. class:: uk.forms.UKPostcodeField
  491. A form field that validates input as a UK postcode. The regular
  492. expression used is sourced from the schema for British Standard BS7666
  493. address types at http://www.cabinetoffice.gov.uk/media/291293/bs7666-v2-0.xml.
  494. .. class:: uk.forms.UKCountySelect
  495. A ``Select`` widget that uses a list of UK counties/regions as its choices.
  496. .. class:: uk.forms.UKNationSelect
  497. A ``Select`` widget that uses a list of UK nations as its choices.
  498. United States of America (``us``)
  499. =================================
  500. .. class:: us.forms.USPhoneNumberField
  501. A form field that validates input as a U.S. phone number.
  502. .. class:: us.forms.USSocialSecurityNumberField
  503. A form field that validates input as a U.S. Social Security Number (SSN).
  504. A valid SSN must obey the following rules:
  505. * Format of XXX-XX-XXXX
  506. * No group of digits consisting entirely of zeroes
  507. * Leading group of digits cannot be 666
  508. * Number not in promotional block 987-65-4320 through 987-65-4329
  509. * Number not one known to be invalid due to widespread promotional
  510. use or distribution (e.g., the Woolworth's number or the 1962
  511. promotional number)
  512. .. class:: us.forms.USStateField
  513. A form field that validates input as a U.S. state name or abbreviation. It
  514. normalizes the input to the standard two-letter postal service abbreviation
  515. for the given state.
  516. .. class:: us.forms.USZipCodeField
  517. A form field that validates input as a U.S. ZIP code. Valid formats are
  518. XXXXX or XXXXX-XXXX.
  519. .. class:: us.forms.USStateSelect
  520. A form ``Select`` widget that uses a list of U.S. states/territories as its
  521. choices.
  522. .. class:: us.models.PhoneNumberField
  523. A :class:`CharField` that checks that the value is a valid U.S.A.-style phone
  524. number (in the format ``XXX-XXX-XXXX``).
  525. .. class:: us.models.USStateField
  526. A model field that forms represent as a ``forms.USStateField`` field and
  527. stores the two-letter U.S. state abbreviation in the database.
  528. Uruguay (``uy``)
  529. ================
  530. .. class:: uy.forms.UYCIField
  531. A field that validates Uruguayan 'Cedula de identidad' (CI) numbers.
  532. .. class:: uy.forms.UYDepartamentSelect
  533. A ``Select`` widget that uses a list of Uruguayan departaments as its
  534. choices.