VAT numbers¶
VAT numbers are used in many countries for taxing purposes. In the European Union, organizations are required to use these VAT numbers when conducting intra-Community trade and e.g. for reverse charging. Although there’s no US equivalent of a VAT number, these are used in most other countries around the world.
- class internationalflavor.vat_number.validators.VATNumberValidator(eu_only=False, include_countries=None, vies_check=False)¶
Validator for checking whether a given VAT number is valid. A VAT number starts with two characters representing the country code, followed by at least 2 characters representing the local VAT number.
Parameters: - eu_only (bool) – By default, all countries are allowed. However, if you are an EU company, you are likely to only want to accept EU VAT numbers.
- include_countries – If set, the list of countries will be limited to the provided list.
- vies_check (bool) – By default, this validator will only validate the syntax of the VAT number. If you need to validate using the EU VAT Information Exchange System (VIES) checker (see http://ec.europa.eu/taxation_customs/vies/), you can set this boolean. This option implies eu_only and requires the suds module to be installed.
Note
If the VIES service can not be reached, this part of the validation will succeed.
Warning
The validation of non-EU VAT numbers may be incomplete or wrong in some cases. Please issue a pull request if you feel there’s an error.
- class internationalflavor.vat_number.models.VATNumberField(eu_only=False, include_countries=None, vies_check=False, *args, **kwargs)¶
A model field that applies the validators.VATNumberValidator and is represented by a forms.VATNumberFormField. The arguments are equal to those of the validator.
Example:
from django.db import models from internationalflavor.vat_number import VATNumberField class MyModel(models.Model): iban = VATNumberField(include_countries=['NL', 'BE'])
This field is an extension of a CharField.
- class internationalflavor.vat_number.forms.VATNumberFormField(eu_only=False, include_countries=None, vies_check=False, *args, **kwargs)¶
A form field that applies the validators.VATNumberValidator. The arguments are equal to those of the validator.