Skip to main content

Django RU validators

Project description

Django russian financial validators

l10n russian validators for INN, bank account number

Build Status


$ pip install django-ru-validators


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


Install dependencies with

$ pip install --requirement requirements.txt

Run tests with

$ python test

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-ru-validators, version 1.7.0
Filename, size File type Python version Upload date Hashes
Filename, size django_ru_validators-1.7.0.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page