Code

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#9066 closed (fixed)

Add Czech localflavor package

Reported by: mathwizard Owned by: Elvard
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 6 years ago.
Patch containing initial implementation of Czech localflavor
cz_localflavour.patch (12.8 KB) - added by Elvard 6 years ago.
Bugs in CZBirthNumberField corrected and appropriate tests provided

Download all attachments as: .zip

Change History (14)

Changed 6 years ago by mathwizard

Patch containing initial implementation of Czech localflavor

comment:1 Changed 6 years ago by Elvard

  • 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 follow-up: Changed 6 years ago by mtredinnick

  • Needs documentation set
  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted
  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 6 years ago by Elvard

  • 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 6 years ago by Elvard

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

comment:5 Changed 6 years ago by Elvard

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 6 years ago by Elvard

  • Triage Stage changed from Accepted to Unreviewed

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

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

Changed 6 years ago by Elvard

Bugs in CZBirthNumberField corrected and appropriate tests provided

comment:7 Changed 6 years ago by Elvard

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:8 Changed 5 years ago by Elvard

  • Owner changed from nobody to Elvard

comment:9 Changed 5 years ago by Elvard

  • milestone set to post-1.0

comment:10 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:11 Changed 5 years ago by russellm

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 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.