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 Provenance Actions
django_ru_validators-1.7.0.tar.gz 2.8 kB Without provenance Details for django_ru_validators-1.7.0.tar.gz

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

Security for django-ru-validators 1.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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