Coder Social home page Coder Social logo

django-internationalflavor's People

Contributors

jarmovanlenthe avatar lociii avatar mambasoft avatar mounirmesselmeni avatar ralphje avatar robingustafsson avatar vincentalvo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

django-internationalflavor's Issues

VAT ID VIES validation not working

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

Not sorted countries

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.

Correct VAT ID is recognized as invalid

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.']

IBAN comparison with other apps is not correct

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).

[bug] Django-internationalflavor fails to import with new pip resolver

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'

Suggestions for improving EU-VIES support

To improve the VAT number field, I'd suggest:

  • Allow any country type by default.
  • only perform a VIES check on EU member states. (now it implies eu_only=True)
  • apply regex checks on other countries, whatever is possible.

I'd prefer having one VAT field, which supports any international number.

KeyError while making migrations

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.

Translations of Form Fields and Error Messages Not Working

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'))

New release?

For Django 3.X the ugettext to gettext change is much needed.
Would help if you released a new version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.