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

Replace vat custom validation with python-stdnum #375

Open johnraz opened 5 years ago

johnraz commented 5 years ago

Hello there,

As a followup to #210 and more recently #370,

I would like to know if you'd be taking a PR that would replace the current VAT validation with the one coming from python-stdnum?

I think it would also probably allow some more options in the clean function to allow for example a compact version of the number to be stored. Nothing too fancy here, just something like a compact boolean attribute to the field init.

Let me know how you feel about this and thanks already for your time 😉

/cc @claudep @benkonrath

claudep commented 5 years ago

At first sight, I would say yes, go for it. I didn't check the code, though.

benkonrath commented 5 years ago

I also think it's a good idea.

If or when I can find some extra time, I'd like to experiment with making a separate django-stdnum package that is a simple generated wrapper for python-stdnum with the goal of deprecating parts of django-localfavor. It just doesn't make sense to me that we keep maintaining custom validation code when there's a high quality library like python-stdnum available. In the meantime, I think it's worth replacing our implementations with stdnum when there's a benefit.

@codingjoe Do you have any thoughts on this?

codingjoe commented 5 years ago

Ff stdnum is the best library around, go for it.

johnraz commented 5 years ago

Quick feedback on this issue, the project I was working on and that required this change has been put on hold for now. I'm still considering to contribute but it may take longer than expected.

carltongibson commented 3 years ago

Relevant discussion on stdnum https://github.com/arthurdejong/python-stdnum/issues/239

Leads to: