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

ar.forms.ARCBUField check digit calculation is incorrect #389

Closed arthurdejong closed 4 years ago

arthurdejong commented 4 years ago

The check digit calculation in ar.forms.ARCBUField is probably incorrect. It does not seem to validate the "28505909 40090418135201" example from https://es.wikipedia.org/wiki/Clave_Bancaria_Uniforme

Note that python-stdnum (disclaimer: I'm the author) already has a pretty well tested implementation and localflavor already depends on it.

If you like, I can make a PR that switches ARCBUField to python-stdnum.

benkonrath commented 4 years ago

Nice work on python-stdnum! A PR for fixing this issue by using python-stdnum would be great - thanks for the offer.

Side note: I'm planning to make a package that generates Django models and forms for all of python-stdnum. I think it makes sense to do this outside of django-localflavor (e.g. create a django-stdnum package) but I want to validate my idea first with a proof of concept and then check with the Django community on a way forward. Having the fix you propose in the next release will still be good.