Opened 19 years ago
Closed 18 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 by , 19 years ago
comment:2 by , 19 years ago
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 by , 19 years ago
| 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 by , 19 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:5 by , 19 years ago
| Needs tests: | set |
|---|---|
| Triage Stage: | Ready for checkin → Accepted |
Needs tests.
comment:6 by , 18 years ago
| Cc: | 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 by , 18 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:8 by , 18 years ago
| Owner: | changed from to |
|---|---|
| Status: | assigned → new |
by , 18 years ago
| Attachment: | patch.2.diff added |
|---|
comment:9 by , 18 years ago
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
by , 18 years ago
| Attachment: | patch.3.diff added |
|---|
comment:10 by , 18 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
The patch looks good. Let a core dev look at it and get it in!
comment:11 by , 18 years ago
| 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).