Skip to main content

Django russian financial validators

l10n russian validators for INN, bank account number

Build Status

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)

Source distribution for django-ru-validators 1.7.0
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

Release history Release notifications | RSS feed

This release

1.7.0 This release

1 release file

1.6.3

1 release file

1.6.2

1 release file

1.6.1

1 release file

1.6

1 release file

1.5

1 release file

1.4

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page