Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9066 closed (fixed)

Add Czech localflavor package

Reported by: mathwizard Owned by: Tomáš Ehrlich
Component: contrib.localflavor Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am attaching a patch containing some form ields for Czech localflavor:

Mainly: CSZipCodeField, CSRegionSelect, CSPhoneNumberField, CSBirthNumberField
Some of them also have model fields added.

Attachments (2)

cs_localflavor.patch (4.9 KB ) - added by mathwizard 16 years ago.
Patch containing initial implementation of Czech localflavor
cz_localflavour.patch (12.8 KB ) - added by Tomáš Ehrlich 16 years ago.
Bugs in CZBirthNumberField corrected and appropriate tests provided

Download all attachments as: .zip

Change History (14)

by mathwizard, 16 years ago

Attachment: cs_localflavor.patch added

Patch containing initial implementation of Czech localflavor

comment:1 by Tomáš Ehrlich, 16 years ago

Commiting another version of Czech flavor (without models).

Changes:

  • Country code is CZ according to ISO 3166
  • Regions Králové-Hradecký and Moravsko-Slezský are written without dash (-)
  • Altered regexp in CZBirthNumberField - slash is optional
  • Removed models and CZPhoneNumberField class
    • Why we need phone number in fromat XXX-XXX-XXX?
    • Why we need models at all in this case? I've looked into several language directories in localflavor directory and I havan't any model files.

comment:2 by Malcolm Tredinnick, 16 years ago

Needs documentation: set
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted
  1. Not worth including model fields at the moment. They are really just normal character fields with choices and validation. So when model-aware validation is included, it will be better to just include some validators for these things that people can add to the CharField. They can already use choices=... to include the regions now, so a special model field isn't needed there.
  1. Our policy is to use the common English names (where such things exist) for any regions, states, etc and then mark them for translation. Then the Czech locale can use the local translated versions if they choose. It looks like there are English names for those regions (for example, wikipedia has a list) so we should be consistent there. I realise the Czech versions are used inside the Czech republic, but things from localflavor are used and read by a broader audience than that.
  1. Neither patch includes tests or documentation.

in reply to:  2 comment:3 by Tomáš Ehrlich, 16 years ago

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Replying to mtredinnick:

  1. Our policy is to use the common English names (where such things exist) for any regions, states, etc and then mark them for translation. Then the Czech locale can use the local translated versions if they choose. It looks like there are English names for those regions (for example, wikipedia has a list) so we should be consistent there. I realise the Czech versions are used inside the Czech republic, but things from localflavor are used and read by a broader audience than that.

I entirely rewrite cz_regions.py using English names. Source is mentioned in module comment, but I'm not sure about all of those names. Please someone to check it.

  1. Neither patch includes tests or documentation.

Sorry, I don't know about that. Tests are included, documentation also (Hope I wrote documentation at the right place)

comment:4 by Tomáš Ehrlich, 16 years ago

I changed name of CZBirthNumberField to CZSocialSecurityNumber (according to localflavor conventions).

comment:5 by Tomáš Ehrlich, 16 years ago

I made final corrections in cz_localflavor.patch (I hope).

Tests are running (Finally I know, how tests works) and Czech local flavor passed all tests.

CZSocialSecurityNumber renamed back to CZBirthNumber according to wiki (http://en.wikipedia.org/wiki/National_identification_number#Czech_Republic)
This method is improved also:

  • It tests the 'modulo of 11' property of Czech Birth number.
  • If optional parametr Gender is specified, it tests the month part of birth number (1 <= mm <= 12, after corrections - month of females is raised by 50)
  • Tests the day part of birth number (1 <= dd <= 31)

comment:6 by Tomáš Ehrlich, 16 years ago

Triage Stage: AcceptedUnreviewed

Names of Czech regions corrected (according to discussion in django-cs user group)

New method added - CZICNumberField, for validation of IC number.

by Tomáš Ehrlich, 16 years ago

Attachment: cz_localflavour.patch added

Bugs in CZBirthNumberField corrected and appropriate tests provided

comment:7 by Tomáš Ehrlich, 16 years ago

Triage Stage: UnreviewedReady for checkin

comment:8 by Tomáš Ehrlich, 16 years ago

Owner: changed from nobody to Tomáš Ehrlich

comment:9 by Tomáš Ehrlich, 16 years ago

milestone: post-1.0

comment:10 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(In [9876]) Fixed #9066 -- Added Czech localflavor. Thanks to Elvard for the contribution.

comment:11 by Russell Keith-Magee, 16 years ago

Elvard - If you drop me an email with your full name and email address, I'll put you in the CONTRIB file. Also, we would be most appreciative if you could complete a contributor's license agreement.

comment:12 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

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