Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#9066 closed (fixed)

Add Czech localflavor package

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

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 8 years ago.
Patch containing initial implementation of Czech localflavor
cz_localflavour.patch (12.8 KB) - added by Tomáš Ehrlich 8 years ago.
Bugs in CZBirthNumberField corrected and appropriate tests provided

Download all attachments as: .zip

Change History (14)

Changed 8 years ago by mathwizard

Attachment: cs_localflavor.patch added

Patch containing initial implementation of Czech localflavor

comment:1 Changed 8 years ago by Tomáš Ehrlich

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

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 Changed 8 years ago by Malcolm Tredinnick

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.

comment:3 in reply to:  2 Changed 8 years ago by Tomáš Ehrlich

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 Changed 8 years ago by Tomáš Ehrlich

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

comment:5 Changed 8 years ago by Tomáš Ehrlich

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 Changed 8 years ago by Tomáš Ehrlich

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.

Changed 8 years ago by Tomáš Ehrlich

Attachment: cz_localflavour.patch added

Bugs in CZBirthNumberField corrected and appropriate tests provided

comment:7 Changed 8 years ago by Tomáš Ehrlich

Triage Stage: UnreviewedReady for checkin

comment:8 Changed 8 years ago by Tomáš Ehrlich

Owner: changed from nobody to Tomáš Ehrlich

comment:9 Changed 8 years ago by Tomáš Ehrlich

milestone: post-1.0

comment:10 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

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

comment:11 Changed 8 years ago by Russell Keith-Magee

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 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

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