Django Walleter
Installation
- Run the pip command to install the latest version:
pip install django_walleter
- Add
django_walleterto yourINSTALLED_APPSin settings.py:
INSTALLED_APPS = (
...
'django_walleter',
)
- Run the migration command:
python manage.py migrate
Usage
Add the HasWallet maixin to your model.
from django.db import models
from django_walleter import HasWallet
class Profile(models.Model, HasWallet):
phone = models.CharField(max_length=255, verbose_name='Phone')
address = models.TextField(max_length=512,verbose_name='Address')
Then you can easily make transactions from your model.
profile = Profile.objects.get(pk=1)
profile.balance // 0
profile.deposit(100)
profile.balance // 100
profile.withdraw(20)
profile.balance // 80
profile2 = Profile.objects.get(pk=2)
profile.transfer(profile2, 20) // or profile.transfer(profile2.wallet, 20)
Remember , you may use the django_walleter.HasWallet mixin on any of your models. You are not limited to only including it on your Profilemodel.
Release files for django-walleter 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-walleter-1.0.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_walleter-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / django-walleter-1.0.tar.gz
| Download URL | django-walleter-1.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b404d7041f46a0cc65aa5bb20e9ed9b970a9883aa21683d55f35c945fa0ae0a1
|
|
BLAKE2b-256 checksum How to use checksums |
355f3662bfcde6fbd8808357f77b93cddb5d3538d63c11c30d41c0ad93531512
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
|
Release files / django_walleter-1.0-py3-none-any.whl
| Download URL | django_walleter-1.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca6db011e065aba751d5e2b17dbfff4782610c3d4eddbcd442d67105027143d2
|
|
BLAKE2b-256 checksum How to use checksums |
9e427da1f2cd4292db3f1b5f1da0e8cee5ab66a0e11d2f91d7ac04be5662d2c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
|