Opened 15 years ago
Closed 15 years ago
#3988 closed (fixed)
Add Canadian (.ca) localflavor
Reported by: | pi | Owned by: | ttarabula |
---|---|---|---|
Component: | contrib.localflavor | Version: | dev |
Severity: | Keywords: | localflavor, ca | |
Cc: | cbrand@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Patch to add a module to django.contrib.localflavor for Canada: CAPostalCodeField, CASocialInsuranceNumberField, CAProvinceField
Attachments (4)
Change History (15)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Can you add a patch for this? i.e. add a new dir. in django.contrib.localflavor for ca and plug this into a "forms.py" file? - see one of the others for examples (e.g. AUPostCodeField in au/forms.py would be close)
comment:3 Changed 15 years ago by
Has patch: | set |
---|
$ svn stat A ca A ca/ca_provinces.py A ca/__init__.py A ca/forms.py
See submitted patch for details.
comment:4 Changed 15 years ago by
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:5 Changed 15 years ago by
Needs tests: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Needs tests.
comment:6 Changed 15 years ago by
Cc: | cbrand@… added |
---|
I think the regex used for postal codes is a little too generous.
Here's what I'm using in my code :
'[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d'
I don't think this is where I got it from, but it does seem to match :
http://www.forta.com/blog/index.cfm?mode=entry&entry=A61BA033-3048-80A9-EFF8935E41AB9FE2
comment:7 Changed 15 years ago by
Owner: | changed from nobody to anonymous |
---|---|
Status: | new → assigned |
comment:8 Changed 15 years ago by
Owner: | changed from anonymous to ttarabula |
---|---|
Status: | assigned → new |
Changed 15 years ago by
Attachment: | patch.2.diff added |
---|
comment:9 Changed 15 years ago by
Addition of tests and modifications to .ca localflavor
Changed terminology "PostCode" to "PostalCode" to stay consistent with other localflavors
Modified CAPostalCodeField regex as per cbrand's advice
Modified CAPhoneNumberField to match USPhoneNumberField
Added CASocialInsuranceNumberField
Added CAProvinceField
Added tests for CAPostalCodeField, CAPhoneNumberField, CAProvinceField, CAProvinceSelect, CASocialInsuranceNumberField
Changed 15 years ago by
Attachment: | patch.3.diff added |
---|
comment:10 Changed 15 years ago by
Triage Stage: | Accepted → Ready for checkin |
---|
The patch looks good. Let a core dev look at it and get it in!
comment:11 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Canadian postal code re pattern:
Note: The RE is valid after normalizing the case to upper case and forcing a single space character between character groups).