Loading django/contrib/localflavor/ca/ca_provinces.py +15 −7 Original line number Diff line number Diff line Loading @@ -8,13 +8,18 @@ Source: http://www.canada.gc.ca/othergov/prov_e.html This exists in this standalone file so that it's only imported into memory when explicitly needed. """ import warnings warnings.warn( 'There have been recent changes to the CA localflavor. See the release notes for details', RuntimeWarning ) PROVINCE_CHOICES = ( ('AB', 'Alberta'), ('BC', 'British Columbia'), ('MB', 'Manitoba'), ('NB', 'New Brunswick'), ('NF', 'Newfoundland and Labrador'), ('NL', 'Newfoundland and Labrador'), ('NT', 'Northwest Territories'), ('NS', 'Nova Scotia'), ('NU', 'Nunavut'), Loading @@ -22,7 +27,7 @@ PROVINCE_CHOICES = ( ('PE', 'Prince Edward Island'), ('QC', 'Quebec'), ('SK', 'Saskatchewan'), ('YK', 'Yukon') ('YT', 'Yukon') ) PROVINCES_NORMALIZED = { Loading @@ -35,9 +40,10 @@ PROVINCES_NORMALIZED = { 'manitoba': 'MB', 'nb': 'NB', 'new brunswick': 'NB', 'nf': 'NF', 'newfoundland': 'NF', 'newfoundland and labrador': 'NF', 'nf': 'NL', 'nl': 'NL', 'newfoundland': 'NL', 'newfoundland and labrador': 'NL', 'nt': 'NT', 'northwest territories': 'NT', 'ns': 'NS', Loading @@ -54,6 +60,8 @@ PROVINCES_NORMALIZED = { 'quebec': 'QC', 'sk': 'SK', 'saskatchewan': 'SK', 'yk': 'YK', 'yukon': 'YK', 'yk': 'YT', 'yt': 'YT', 'yukon': 'YT', 'yukon territory': 'YT', } No newline at end of file docs/releases/1.3.txt +5 −0 Original line number Diff line number Diff line Loading @@ -475,6 +475,11 @@ local flavors: has been removed from the province list in favor of the new official designation "Aceh (ACE)". * Canada (ca) -- The province "Newfoundland and Labrador" has had its province code updated to "NL", rather than the older "NF". In addition, the Yukon Territory has had its province code corrected to "YT", instead of "YK". FormSet updates ~~~~~~~~~~~~~~~ Loading tests/regressiontests/forms/localflavor/ca.py +15 −2 Original line number Diff line number Diff line import warnings from django.contrib.localflavor.ca.forms import (CAPostalCodeField, CAPhoneNumberField, CAProvinceField, CAProvinceSelect, CASocialInsuranceNumberField) Loading @@ -6,6 +8,17 @@ from utils import LocalFlavorTestCase class CALocalFlavorTests(LocalFlavorTestCase): def setUp(self): self.save_warnings_state() warnings.filterwarnings( "ignore", category=RuntimeWarning, module='django.contrib.localflavor.ca.ca_provinces' ) def tearDown(self): self.restore_warnings_state() def test_CAProvinceSelect(self): f = CAProvinceSelect() out = u'''<select name="province"> Loading @@ -13,7 +26,7 @@ class CALocalFlavorTests(LocalFlavorTestCase): <option value="BC">British Columbia</option> <option value="MB">Manitoba</option> <option value="NB">New Brunswick</option> <option value="NF">Newfoundland and Labrador</option> <option value="NL">Newfoundland and Labrador</option> <option value="NT">Northwest Territories</option> <option value="NS">Nova Scotia</option> <option value="NU">Nunavut</option> Loading @@ -21,7 +34,7 @@ class CALocalFlavorTests(LocalFlavorTestCase): <option value="PE">Prince Edward Island</option> <option value="QC">Quebec</option> <option value="SK">Saskatchewan</option> <option value="YK">Yukon</option> <option value="YT">Yukon</option> </select>''' self.assertEqual(f.render('province', 'AB'), out) Loading Loading
django/contrib/localflavor/ca/ca_provinces.py +15 −7 Original line number Diff line number Diff line Loading @@ -8,13 +8,18 @@ Source: http://www.canada.gc.ca/othergov/prov_e.html This exists in this standalone file so that it's only imported into memory when explicitly needed. """ import warnings warnings.warn( 'There have been recent changes to the CA localflavor. See the release notes for details', RuntimeWarning ) PROVINCE_CHOICES = ( ('AB', 'Alberta'), ('BC', 'British Columbia'), ('MB', 'Manitoba'), ('NB', 'New Brunswick'), ('NF', 'Newfoundland and Labrador'), ('NL', 'Newfoundland and Labrador'), ('NT', 'Northwest Territories'), ('NS', 'Nova Scotia'), ('NU', 'Nunavut'), Loading @@ -22,7 +27,7 @@ PROVINCE_CHOICES = ( ('PE', 'Prince Edward Island'), ('QC', 'Quebec'), ('SK', 'Saskatchewan'), ('YK', 'Yukon') ('YT', 'Yukon') ) PROVINCES_NORMALIZED = { Loading @@ -35,9 +40,10 @@ PROVINCES_NORMALIZED = { 'manitoba': 'MB', 'nb': 'NB', 'new brunswick': 'NB', 'nf': 'NF', 'newfoundland': 'NF', 'newfoundland and labrador': 'NF', 'nf': 'NL', 'nl': 'NL', 'newfoundland': 'NL', 'newfoundland and labrador': 'NL', 'nt': 'NT', 'northwest territories': 'NT', 'ns': 'NS', Loading @@ -54,6 +60,8 @@ PROVINCES_NORMALIZED = { 'quebec': 'QC', 'sk': 'SK', 'saskatchewan': 'SK', 'yk': 'YK', 'yukon': 'YK', 'yk': 'YT', 'yt': 'YT', 'yukon': 'YT', 'yukon territory': 'YT', } No newline at end of file
docs/releases/1.3.txt +5 −0 Original line number Diff line number Diff line Loading @@ -475,6 +475,11 @@ local flavors: has been removed from the province list in favor of the new official designation "Aceh (ACE)". * Canada (ca) -- The province "Newfoundland and Labrador" has had its province code updated to "NL", rather than the older "NF". In addition, the Yukon Territory has had its province code corrected to "YT", instead of "YK". FormSet updates ~~~~~~~~~~~~~~~ Loading
tests/regressiontests/forms/localflavor/ca.py +15 −2 Original line number Diff line number Diff line import warnings from django.contrib.localflavor.ca.forms import (CAPostalCodeField, CAPhoneNumberField, CAProvinceField, CAProvinceSelect, CASocialInsuranceNumberField) Loading @@ -6,6 +8,17 @@ from utils import LocalFlavorTestCase class CALocalFlavorTests(LocalFlavorTestCase): def setUp(self): self.save_warnings_state() warnings.filterwarnings( "ignore", category=RuntimeWarning, module='django.contrib.localflavor.ca.ca_provinces' ) def tearDown(self): self.restore_warnings_state() def test_CAProvinceSelect(self): f = CAProvinceSelect() out = u'''<select name="province"> Loading @@ -13,7 +26,7 @@ class CALocalFlavorTests(LocalFlavorTestCase): <option value="BC">British Columbia</option> <option value="MB">Manitoba</option> <option value="NB">New Brunswick</option> <option value="NF">Newfoundland and Labrador</option> <option value="NL">Newfoundland and Labrador</option> <option value="NT">Northwest Territories</option> <option value="NS">Nova Scotia</option> <option value="NU">Nunavut</option> Loading @@ -21,7 +34,7 @@ class CALocalFlavorTests(LocalFlavorTestCase): <option value="PE">Prince Edward Island</option> <option value="QC">Quebec</option> <option value="SK">Saskatchewan</option> <option value="YK">Yukon</option> <option value="YT">Yukon</option> </select>''' self.assertEqual(f.render('province', 'AB'), out) Loading