Django wallet
Project description
Django Walleter
Installation
- Run the pip command to install the latest version:
pip install django_walleter
- Add
django_walleter
to yourINSTALLED_APPS
in 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 Profile
model.
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
django-walleter-1.0.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for django_walleter-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca6db011e065aba751d5e2b17dbfff4782610c3d4eddbcd442d67105027143d2 |
|
MD5 | ff6c854edf6e80c99d2714ac987dddbe |
|
BLAKE2b-256 | 9e427da1f2cd4292db3f1b5f1da0e8cee5ab66a0e11d2f91d7ac04be5662d2c5 |