Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FRNationalIdentificationNumber validation for Corsica department #186

Merged
merged 2 commits into from
Nov 27, 2015

Conversation

tomdrn
Copy link
Contributor

@tomdrn tomdrn commented Nov 25, 2015

An error was made on the FRNationalIdentificationNumber validation, department 20 (for Corsica) can't be ignored if birthdate is older than 1976.

Before January 1976, department number for Corsica was 20. From 1976, Corsica has been divided into two number : 2A and 2B, as said on the French departments page of wikipedia :

In 1976, Corsica (number 20) was divided between the Corse-du-Sud (2A) and Haute-Corse (2B). (...) Social security numbers composition has changed for people born after 1 January 1976, the "20" has been replaced by "2A" or "2B".

Therefore we can't consider a French national identification number invalid if department number is 20 and birthdate < 1976.

For the record, this is not specified on the English version of the French departments page of wikipedia.

@@ -213,6 +213,8 @@ def test_FRNationalIdentificationNumber(self):
invalid = {
'369067543002289': error_format, # Gender mismatch
'869069873002289': error_format, # Bad Department
'878062073002289': error_format, # Bad Department with birthdate
'869062A73002289': error_format, # Bad Department with birthdate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be more specific in the comment message, and also add some entries in the valid dictionary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'll do this

@tomdrn
Copy link
Contributor Author

tomdrn commented Nov 26, 2015

@claudep Good for me, I added few tests and updated comments

claudep added a commit that referenced this pull request Nov 27, 2015
…tment

Fix FRNationalIdentificationNumber validation for Corsica department
@claudep claudep merged commit 989fc3a into django:master Nov 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants