django / django-localflavor

Country-specific Django helpers, formerly of contrib fame
https://django-localflavor.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
813 stars 289 forks source link

Fix French national identification number validation with people born overseas #415

Closed leo-naeka closed 4 years ago

leo-naeka commented 4 years ago

I realized that localflavor does not allow the entry of NIR with 98 as the birth department, excluding it because 98 would correspond to Monaco.

In fact, 98 is used for "COM" (eg. French Polynesia, Wallis and Futuna, New Caledonia) and people born in Monaco would have 99 as department_of_origin and 138 as commune_of_origin (99 stands for a birth abroad and 138 is the INSEE code for Monaco).

This codification is a real mess, I've attached two official INSEE documents, which are more complete and reliable sources than Wikipedia (page 6 is a good summary).

This fix add the following changes:


INSEE Guide identification.pdf INSEE Codes Pays.pdf

benkonrath commented 4 years ago

It looks good, thanks!

Just two small remarks:

I can merge this as soon as the links are added if that's possible. Thanks.

leo-naeka commented 4 years ago
  • It would be nice if you could include links to the PDFs that you attached. It's nice that they're attached on this issue but links to the reference documents in the code help make them a little more discoverable.

@benkonrath I had those documents for some time, grabbed from an administrative site but can't find their links anymore (and we definitively should not rely on these sites to preserve access over time), so I've put them on Scribd.

Ok for me to merge like this, let me know if you prefer these commits squashed.

benkonrath commented 4 years ago

Thanks, I rebased and squashed the commits on merge (it's easy to do directly in github these days).