Django

Code

Ticket #3988 (closed: fixed)

Opened 2 years ago

Last modified 1 year ago

Add Canadian (.ca) localflavor

Reported by: pi Assigned to: ttarabula
Milestone: Component: django.contrib.localflavor
Version: SVN Keywords: localflavor, ca
Cc: cbrand@redback.com Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

Description

Patch to add a module to django.contrib.localflavor for Canada: CAPostalCodeField, CASocialInsuranceNumberField, CAProvinceField

Attachments

patch.diff (2.6 kB) - added by pi on 04/19/07 06:28:50.
Addition of .ca localflavor code
patch.2.diff (7.2 kB) - added by ttarabula on 09/14/07 12:50:33.
patch.3.diff (7.2 kB) - added by ttarabula on 09/14/07 12:55:23.
patch.4.diff (13.3 kB) - added by ttarabula on 09/14/07 13:03:03.
Forgot to do an svn add before the svn diff

Change History

04/10/07 06:54:13 changed by pi

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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).

04/11/07 05:32:25 changed by Simon G. <dev@simon.net.nz>

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)

04/19/07 06:28:50 changed by pi

  • attachment patch.diff added.

Addition of .ca localflavor code

04/19/07 06:30:57 changed by pi

  • has_patch set to 1.
$ svn stat
A      ca
A      ca/ca_provinces.py
A      ca/__init__.py
A      ca/forms.py

See submitted patch for details.

04/21/07 08:06:53 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Unreviewed to Ready for checkin.

04/25/07 02:37:58 changed by mtredinnick

  • needs_tests set to 1.
  • stage changed from Ready for checkin to Accepted.

Needs tests.

06/28/07 19:08:20 changed by cbrand@redback.com

  • cc set to cbrand@redback.com.

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

09/14/07 10:36:57 changed by ttarabula

  • owner changed from nobody to anonymous.
  • status changed from new to assigned.

09/14/07 10:38:02 changed by ttarabula

  • owner changed from anonymous to ttarabula.
  • status changed from assigned to new.

09/14/07 12:50:33 changed by ttarabula

  • attachment patch.2.diff added.

09/14/07 12:51:23 changed by ttarabula

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

09/14/07 12:55:23 changed by ttarabula

  • attachment patch.3.diff added.

09/14/07 13:03:03 changed by ttarabula

  • attachment patch.4.diff added.

Forgot to do an svn add before the svn diff

09/14/07 13:08:36 changed by brosner

  • stage changed from Accepted to Ready for checkin.

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

09/14/07 14:02:05 changed by jacob

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #3988 (Add Canadian (.ca) localflavor)




Change Properties
Action