A simple Django app that provides Indonesian Bank models and fields.
Project description
A Django application that provides Indonesian bank choices for use with forms and a country field for models.
Installation
pip install p1-bank
Add bank to INSTALLED_APPS
Run python manage.py migrate to create banks models
Bank Model
A model of bank that holds all banks in Indonesia.
Supports long name, short name, bank code, and branch code.
>>> from django.apps import apps
>>> Bank = apps.get_model('bank', 'Bank')
>>> bank = Bank.get(short_name='Bank BCA')
>>> bank.long_name
'PT. Bank Central Asia Tbk.'
>>> bank.short_name
'Bank BCA'
>>> bank.bank_code
'014'
>>> bank.branch_code
'0397'
>>> bank.bi_code
'0140397'
Bank Field
BankField is based on Django’s ForeignKey, a relationship to Bank model.
Consider the following model using a BankField:
from django.db import models
from p1_bank.fields import BankField
class Account(models.Model):
name = models.CharField(max_length=100)
bank = BankField(related_name='accounts')
Any Account instance will have a bank attribute that you can use to identify account’s bank:
>>> bank = Bank.objects.get(short_name='Bank BCA')
>>> account = Account.objects.create(name='Kania', bank=bank)
>>> account.bank
'Bank BCA'
>>> account.bank.code
'014'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file p1-bank-0.2.36160053.tar.gz
.
File metadata
- Download URL: p1-bank-0.2.36160053.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 741730b806957760a890605f740c433c12d76c221c7da000ee786aa49a49c8f2 |
|
MD5 | 57f277feb0b5be6187216059e15d9f68 |
|
BLAKE2b-256 | 7d83355f9b1d15b6baec33a2b4c3e8818fbdbb106bb13a2d11c1d49f644f5c2c |
File details
Details for the file p1_bank-0.2.36160053-py2-none-any.whl
.
File metadata
- Download URL: p1_bank-0.2.36160053-py2-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce940ec10e1c1197fecea2c360b372bf9766b78b9f0148c9c03158017c2f6b36 |
|
MD5 | 72e0b9c9e0f55353cd5e2734d7ff5a77 |
|
BLAKE2b-256 | edb6792c02313d6126b8674a4a0cbac9df44f9805957a71d22e107c393cd60db |