Opened 18 years ago

Closed 17 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)

patch.diff (2.6 KB ) - added by pi 18 years ago.
Addition of .ca localflavor code
patch.2.diff (7.2 KB ) - added by ttarabula 17 years ago.
patch.3.diff (7.2 KB ) - added by ttarabula 17 years ago.
patch.4.diff (13.3 KB ) - added by ttarabula 17 years ago.
Forgot to do an svn add before the svn diff

Download all attachments as: .zip

Change History (15)

comment:1 by pi, 18 years ago

Canadian postal code re pattern:

'^[A-Z]\d[A-Z] \d[A-Z]\d$'

Note: The RE is valid after normalizing the case to upper case and forcing a single space character between character groups).

comment:2 by Simon G. <dev@…>, 18 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)

by pi, 18 years ago

Attachment: patch.diff added

Addition of .ca localflavor code

comment:3 by pi, 18 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 Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedReady for checkin

comment:5 by Malcolm Tredinnick, 18 years ago

Needs tests: set
Triage Stage: Ready for checkinAccepted

Needs tests.

comment:6 by cbrand@…, 17 years ago

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 by ttarabula, 17 years ago

Owner: changed from nobody to anonymous
Status: newassigned

comment:8 by ttarabula, 17 years ago

Owner: changed from anonymous to ttarabula
Status: assignednew

by ttarabula, 17 years ago

Attachment: patch.2.diff added

comment:9 by ttarabula, 17 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 ttarabula, 17 years ago

Attachment: patch.3.diff added

by ttarabula, 17 years ago

Attachment: patch.4.diff added

Forgot to do an svn add before the svn diff

comment:10 by Brian Rosner, 17 years ago

Triage Stage: AcceptedReady for checkin

The patch looks good. Let a core dev look at it and get it in!

comment:11 by Jacob, 17 years ago

Resolution: fixed
Status: newclosed

(In [6202]) Fixed #3988: added a localflavor for our friends to the north (i.e. Canada). THanks, Tyler Tarabula.

Note: See TracTickets for help on using tickets.
Back to Top