From 03a4a061741f819d2047eda7cd4b6ab156cb7e17 Mon Sep 17 00:00:00 2001 From: Ekirapapaul Date: Sun, 9 Aug 2020 20:18:24 +0300 Subject: [PATCH] TCW Add base model to main models file and upgrade module version --- mpesa/migrations/0004_auto_20200809_1604.py | 18 ++++++++++++++++++ mpesa/models.py | 14 +++++++++++++- setup.cfg | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 mpesa/migrations/0004_auto_20200809_1604.py diff --git a/mpesa/migrations/0004_auto_20200809_1604.py b/mpesa/migrations/0004_auto_20200809_1604.py new file mode 100644 index 0000000..ca1e1e4 --- /dev/null +++ b/mpesa/migrations/0004_auto_20200809_1604.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.5 on 2020-08-09 16:04 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('mpesa', '0003_paymenttransaction_order_id'), + ] + + operations = [ + migrations.RenameField( + model_name='wallet', + old_name='uid', + new_name='uuid', + ), + ] diff --git a/mpesa/models.py b/mpesa/models.py index 9b6d96d..d84c0c1 100644 --- a/mpesa/models.py +++ b/mpesa/models.py @@ -3,10 +3,22 @@ from django.db import models from django.conf import settings -from mpesa.commons.models import BaseModel +import uuid # Create your models here. +class BaseModel(models.Model): + uuid = models.UUIDField(default=uuid.uuid4, editable=False) + id = models.AutoField(primary_key=True) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + is_active = models.BooleanField(default=True, blank=True) + is_deleted = models.BooleanField(default=False, blank=True) + + class Meta: + abstract = True + + class PaymentTransaction(models.Model): phone_number = models.CharField(max_length=30) amount = models.DecimalField(('amount'), max_digits=6, decimal_places=2, default=0) diff --git a/setup.cfg b/setup.cfg index f650c86..6f4957f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = django-mpesa -version = 1.1 +version = 1.3 description = A python library that interfaces safaricoms mpesa apis long_description = file: README.rst url = https://www.vorane.com/