Skip to main content

A validated IBAN field for Django models

Project description

django-iban
===========

.. image:: https://secure.travis-ci.org/benkonrath/django-iban.png?branch=master
:target: http://travis-ci.org/benkonrath/django-iban?branch=master
.. image:: https://coveralls.io/repos/benkonrath/django-iban/badge.png?branch=master
:target: https://coveralls.io/r/benkonrath/django-iban?branch=master
.. image:: https://pypip.in/v/django-iban/badge.png
:target: https://crate.io/packages/django-iban/
.. image:: https://pypip.in/d/django-iban/badge.png
:target: https://crate.io/packages/django-iban/

Validated Django model fields for `International Bank Account Numbers`_ (IBAN - ISO 13616-1:2007) and `SWIFT-BIC`_ (ISO 9362:2009).

.. WARNING::
Obsolete package. You should not use this package any longer. The IBAN and BIC fields are now available in version 1.1 and later of the https://pypi.python.org/pypi/django-localflavor package. Bug reports and feature requests should be filed against django-localflavor.

**Author:** Ben Konrath

**License:** 3-clause BSD

**Features:**

* Validates IBAN using the official validation algorithm.
* Support for all currently active and planned to be active IBAN countries / numbers.
* Optional validation for IBANs included the Nordea IBAN extensions.
* Optionally limit validation to a list specific of countries.
* Basic validation for SWIFT-BIC.
* Supports Django 1.4, 1.5 and 1.6.
* Python 3.2 and 3.3 support for Django >= 1.5.

**Usage:**

Use the model fields ``IBANField`` and/or ``SWIFTBICField`` in your models::

from django.db import models
from django_iban.fields import IBANField, SWIFTBICField

class CustomerModel(models.Model):
iban = IBANField()
swift_bic = SWIFTBICField()

Use the form fields ``IBANFormField`` and/or ``SWIFTBICFormField`` in your forms::

from django import forms
from django_iban.forms import IBANFormField, SWIFTBICFormField

class CustomerForm(forms.Form):
iban = IBANFormField()
swift_bic = SWIFTBICFormField()

To limit IBAN validation to specific countries, set the 'include_countries' argument with a tuple or list of ISO 3166-1
alpha-2 codes. For example, `include_countries=('NL', 'BE, 'LU')`.

A list of countries that use IBANs as part of SEPA is included for convenience. To use this feature, set
`include_countries=IBAN_SEPA_COUNTRIES` as an argument to the field.

Example::

from django.db import models
from django_iban.fields import IBANField,
from django_iban.sepa_countries import IBAN_SEPA_COUNTRIES

class MyModel(models.Model):
iban = IBANField(include_countries=IBAN_SEPA_COUNTRIES)

In addition to validating official IBANs, this field can optionally validate unofficial IBANs that have been
catalogued by Nordea by setting the `use_nordea_extensions` argument to True.


**Development:**

Coding style: PEP8 with 120 character lines.

TODO:

* Contribute SWIFT-BIC field to django-localflavor and depreciate this app.


Pull requests happily accepted.

.. _International Bank Account Numbers: https://en.wikipedia.org/wiki/International_Bank_Account_Number
.. _SWIFT-BIC: https://en.wikipedia.org/wiki/ISO_9362

Project details


Download files

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

Source Distribution

django-iban-0.3.0.tar.gz (14.1 kB view details)

Uploaded Source

File details

Details for the file django-iban-0.3.0.tar.gz.

File metadata

  • Download URL: django-iban-0.3.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-iban-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0230584bf8eb0f6294330e8c641debf83e10e7048ca72abcd49244c19dde0056
MD5 457943a776aa2099a4014684d14ed96b
BLAKE2b-256 e87eb6e09349e149ae1589bad921fc58b3469cf9167f1a09d6bdc98a540ac6ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page