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