PageRenderTime 20ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/django/contrib/localflavor/ca/ca_provinces.py

https://code.google.com/p/mango-py/
Python | 67 lines | 57 code | 0 blank | 10 comment | 3 complexity | db84bb93c678045c670733aace8c2b61 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. """
  2. An alphabetical list of provinces and territories for use as `choices`
  3. in a formfield., and a mapping of province misspellings/abbreviations to
  4. normalized abbreviations
  5. Source: http://www.canada.gc.ca/othergov/prov_e.html
  6. This exists in this standalone file so that it's only imported into memory
  7. when explicitly needed.
  8. """
  9. import warnings
  10. warnings.warn(
  11. 'There have been recent changes to the CA localflavor. See the release notes for details',
  12. RuntimeWarning
  13. )
  14. PROVINCE_CHOICES = (
  15. ('AB', 'Alberta'),
  16. ('BC', 'British Columbia'),
  17. ('MB', 'Manitoba'),
  18. ('NB', 'New Brunswick'),
  19. ('NL', 'Newfoundland and Labrador'),
  20. ('NT', 'Northwest Territories'),
  21. ('NS', 'Nova Scotia'),
  22. ('NU', 'Nunavut'),
  23. ('ON', 'Ontario'),
  24. ('PE', 'Prince Edward Island'),
  25. ('QC', 'Quebec'),
  26. ('SK', 'Saskatchewan'),
  27. ('YT', 'Yukon')
  28. )
  29. PROVINCES_NORMALIZED = {
  30. 'ab': 'AB',
  31. 'alberta': 'AB',
  32. 'bc': 'BC',
  33. 'b.c.': 'BC',
  34. 'british columbia': 'BC',
  35. 'mb': 'MB',
  36. 'manitoba': 'MB',
  37. 'nb': 'NB',
  38. 'new brunswick': 'NB',
  39. 'nf': 'NL',
  40. 'nl': 'NL',
  41. 'newfoundland': 'NL',
  42. 'newfoundland and labrador': 'NL',
  43. 'nt': 'NT',
  44. 'northwest territories': 'NT',
  45. 'ns': 'NS',
  46. 'nova scotia': 'NS',
  47. 'nu': 'NU',
  48. 'nunavut': 'NU',
  49. 'on': 'ON',
  50. 'ontario': 'ON',
  51. 'pe': 'PE',
  52. 'pei': 'PE',
  53. 'p.e.i.': 'PE',
  54. 'prince edward island': 'PE',
  55. 'qc': 'QC',
  56. 'quebec': 'QC',
  57. 'sk': 'SK',
  58. 'saskatchewan': 'SK',
  59. 'yk': 'YT',
  60. 'yt': 'YT',
  61. 'yukon': 'YT',
  62. 'yukon territory': 'YT',
  63. }