ralphje / django-internationalflavor Goto Github PK
View Code? Open in Web Editor NEWComplementing django-localflavor with fields that are applicable to multiple countries
License: Other
Complementing django-localflavor with fields that are applicable to multiple countries
License: Other
The current regexp seems to match the old format, the new format is not accepted.
More details:
https://www.meridianglobalservices.com/blog/2013/01/01/New-tax-number-format-Ireland
Example of VAT number not accepted:
1234567FA
It seems like VIES validation is not working, whatever I try a made up VAT ID for example SI11111111 does not throw a validation error.
in my model: vat_number = VATNumberField(vies_check=True)
thanks
Hi. The choices of CountryFormField are not sorted. Is it a purpose?
Right now, I have to use choices argument to fix that like this:
choices = sorted(get_countries_lazy(), key=lambda o: o[1])
It would be great if the choices are sorted by country name by default.
The VIES check service does validate a VAT number starting with EU, while django-internationalflavor does not include this prefix while validating countries.
It seems that VAT ID NL001266526B03
is not recognized properly. VIES reports it as valid, while the module reacts:
~/.local/lib/python3.8/site-packages/internationalflavor/vat_number/validators.py in _country_specific_check(self, country, rest)
129 if country == 'NL': # validate against modified elfproef
130 if _get_check_digit(rest, [9, 8, 7, 6, 5, 4, 3, 2, -1]) != 0:
--> 131 raise ValidationError(self.country_failure % {'country': country})
132
133 elif country == 'BE': # validate with Modulus97 test
ValidationError: ['This VAT number does not match the requirements for NL.']
Hi, checking the code I see that the United Kingdom code "GB" still part of the EU_VAT_AREA
. Are there any reason why is there after Brexit?
Hi, Great work on this module. I'm probably going to use the VAT field in my project.
I'm the author of django-iban which was the basis for the django-localflavor IBAN and BIC fields. Your comparison documentation is not correct and it would be nice to have this corrected.
This module also supports a IBANField, but does not validate against regular expressions, rather validating the length of the IBAN for each country code. The validation provided by :mod:`internationalflavor` is more extensive by using regular expressions.
The IBAN fields in django-localflavor does in fact check the length for the specific country but it also does a full checksum validation as per the official IBAN validation guide (just like your code).
https://github.com/django/django-localflavor/blob/1.1/localflavor/generic/validators.py#L111
As far as I can see, there is no real functional difference between your version and the version in django-localflavor. But I would love to work together on making the django-localflavor version better if there is a problem with it. The reason I contributed the code to django-localflavor was so that there could be a community maintained version of this validation rather than a bunch of solo devs trying to hack this out on our own.
Additionally, we provide a :class:`BICField` for SWIFT BIC validation.
This is also not correct. django-localflavor has a BICField as well.
https://github.com/django/django-localflavor/blob/1.1/localflavor/generic/models.py#L55
Like I said, if there is a problem with the localflavor versions of the IBAN or BIC fields, I would be very happy to see a bug report or review a PR against django-localflavor. At the very least, your documentation should be updated to accurately reflect the differences between the two versions (which seems to be nothing).
In October 2020, pip
will switch to a new resolver and one can test it already now with --use-feature=2020-resolver
. This fails horribly on django-internationalflavor
and the cause appears to be a packaging error (wrong metadata in package): This works fine with the old pip
resolver but the new one is stricter.
pip install django-internationalflavor --use-feature=2020-resolver
0-resolver
Collecting django-internationalflavor
Downloading django-internationalflavor-0.4.0-1.tar.gz (12.4 MB)
|████████████████████████████████| 12.4 MB 15.8 MB/s
ERROR: Requested django-internationalflavor from
https://files.pythonhosted.org/packages/c7<hash>/django-internationalflavor-0.4.0-1.tar.gz#sha256=<hash>
has different version in metadata: '0.4.0'
To improve the VAT number field, I'd suggest:
I'd prefer having one VAT field, which supports any international number.
Hi, I am running into this issue using:
Python 3.5.2
django-internationalflavor==0.3.0
Django==1.10.3
class User(AbstractUser):
...
country = CountryField()
python manage.py makemigrations
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 150, in handle
ProjectState.from_apps(apps),
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/django/db/migrations/state.py", line 188, in from_apps
model_state = ModelState.from_model(model)
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/django/db/migrations/state.py", line 374, in from_model
fields.append((name, field.clone()))
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 457, in clone
name, path, args, kwargs = self.deconstruct()
File "/Users/erik/env/giaroo/lib/python3.5/site-packages/internationalflavor/countries/models.py", line 32, in deconstruct
del kwargs["choices"]
Any help is appreciated. Thank you.
I use this package to implement an IBAN and a BIC field in a form. The multilingual site is based on the Wagtail CMS and the Django framework, of course. The two fields are working like a charm, only the translations are missing. I have seen the locale directory of this package and found all necessary translations in the .PO-files. How do I get them to work? Here are my language settings, to give a bit more context:
# settings.py
LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [
('en', _('English')),
('de', _('German')),
]
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
)
# forms.py
class SubscriptionForm(forms.Form):
iban = IBANFormField(required=False, label=_('IBAN'))
bic = BICFormField(required=False, label=_('BIC'))
For Django 3.X the ugettext
to gettext
change is much needed.
Would help if you released a new version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.