Django Banks
A Django application that provides Indonesian bank choices for use with forms and a country field for models.
Installation
Run pip install p1-bank
Add 'bank' to INSTALLED_APPS in settings.py
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.objects.get(short_name='BANK BCA')
>>> bank.long_name
u'PT. BANK CENTRAL ASIA TBK.'
>>> bank.short_name
u'BANK BCA'
>>> bank.bank_code
u'014'
>>> bank.branch_code
u'0397'
>>> bank.bi_code
u'0140397'
It is possible to get a bank object from bi code:
>>> Bank.objects.get_by_bi_code('0140397')
<Bank: BANK BCA>
or upsert (update or create) from list with header:
>>> Bank.objects.get(bank_code='200')
<Bank: BANK BTN>
>>> bank_list = [
['bank_code', 'short_name'],
['200', 'BTN']
]
>>> Bank.objects.upsert_from_list_with_header(bank_list)
>>> Bank.objects.get(bank_code='200')
<Bank: BTN>
Bank Field
BankField is based on Django’s ForeignKey, a relationship to Bank model.
Consider an Account 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'
Bank Factories
You may use bank factories to support your test (requires factory_boy)
>>> from bank.factories import BankFactory
>>> BankFactory()
<Bank: Bank X00>
>>> BankFactory()
<Bank: Bank X01>
>>> bank301 = BankFactory(bank_code='301')
>>> bank301.bank_code
'301'
Metadata
Release files for p1-bank 0.2.53356116
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| p1-bank-0.2.53356116.tar.gz | 10.3 kB | Without provenance | Details for p1-bank-0.2.53356116.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| p1_bank-0.2.53356116-py2-none-any.whl | Python 2 | none | any | Details for p1_bank-0.2.53356116-py2-none-any.whl |
Total release size: 25.1 kB
Release files / p1-bank-0.2.53356116.tar.gz
| Download URL | p1-bank-0.2.53356116.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b95a6899f6b6dfbf0c6569f3c0bb3626f420b64e79aad1f0bb81c70ca721da8
|
|
BLAKE2b-256 checksum How to use checksums |
55541a4dcc70418da206ff08a31e54795445239fd1d2330d7267dbf07613d8ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.8.2 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/2.7.18
|
Release files / p1_bank-0.2.53356116-py2-none-any.whl
| Download URL | p1_bank-0.2.53356116-py2-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
a3c6dd4e05434c753a3c735fb79d82f2a995de6c2bcb275987c61eede6d2849f
|
|
BLAKE2b-256 checksum How to use checksums |
4d222f378d96c29e1b90148417a9b98baa89f0752e0cf307a910382fe956f9da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.8.2 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/2.7.18
|
Security for p1-bank 0.2.53356116
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.