Django russian financial validators
l10n russian validators for INN, bank account number
Install
$ pip install django-ru-validators
Usage
from django import forms
from django.db import models
from django.core.exceptions import ValidationError
from django_ru_validators import validate_inn, BankAccountNumberValidator
class PaymentOrder(models.Model):
recipient_inn = models.CharField(validators=[validate_inn])
recipient_account_number = models.CharField()
recipient_bank = models.CharField()
class PaymentOrderForm(forms.ModelForm):
class Meta:
model = PaymentOrder
fields = ("recipient_inn", "recipient_account_number", "recipient_bik")
def clean(self):
cleaned_data = super().clean()
recipient_account_number = cleaned_data.get("recipient_account_number")
recipient_bik = cleaned_data.get("recipient_bik")
try:
BankAccountNumberValidator(recipient_bik)(recipient_account_number)
except ValidationError:
msg = "Wrong combination of account number and bik of bank"
self.add_error("recipient_account_number", msg)
self.add_error("recipient_bik", msg)
return cleaned_data
Development
Install dependencies with
$ pip install --requirement requirements.txt
Run tests with
$ python setup.py test
Metadata
Release files for django-ru-validators 1.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_ru_validators-1.7.0.tar.gz | 2.8 kB | Details |
Release files / django_ru_validators-1.7.0.tar.gz
| Download URL | django_ru_validators-1.7.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95652b3e667564a475dceb0af4f217cf863ede6fd0bdff2d6d5d3bc4960ec95a
|
|
BLAKE2b-256 checksum How to use checksums |
dffcb4644e9c5b783f0d21feca4cfd29b6bddd9b0a7efe16280a9bb7d3e18396
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.1
|