Add generic_payment_id field to HostingOrder migration and
reflect generic payments in adminsite
This commit is contained in:
parent
c7edcdc8b1
commit
332e7d6624
2 changed files with 33 additions and 3 deletions
20
hosting/migrations/0048_hostingorder_generic_payment_id.py
Normal file
20
hosting/migrations/0048_hostingorder_generic_payment_id.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.4 on 2018-09-23 09:34
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hosting', '0047_auto_20180821_1240'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='hostingorder',
|
||||
name='generic_payment_id',
|
||||
field=models.CharField(editable=False, max_length=128, null=True),
|
||||
),
|
||||
]
|
|
@ -9,8 +9,8 @@ from django.utils.functional import cached_property
|
|||
|
||||
from datacenterlight.models import VMPricing, VMTemplate
|
||||
from membership.models import StripeCustomer, CustomUser
|
||||
from utils.models import BillingAddress
|
||||
from utils.mixins import AssignPermissionsMixin
|
||||
from utils.models import BillingAddress
|
||||
from utils.stripe_utils import StripeUtils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -80,6 +80,9 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
|
|||
OrderDetail, null=True, blank=True, default=None,
|
||||
on_delete=models.SET_NULL
|
||||
)
|
||||
generic_payment_id = models.CharField(
|
||||
max_length=128, null=True, editable=False
|
||||
)
|
||||
|
||||
permissions = ('view_hostingorder',)
|
||||
|
||||
|
@ -89,11 +92,18 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
|
|||
)
|
||||
|
||||
def __str__(self):
|
||||
return ("Order Nr: #{} - VM_ID: {} - {} - {} - "
|
||||
hosting_order_str = ("Order Nr: #{} - VM_ID: {} - {} - {} - "
|
||||
"Specs: {} - Price: {}").format(
|
||||
self.id, self.vm_id, self.customer.user.email, self.created_at,
|
||||
self.order_detail, self.price
|
||||
)
|
||||
if self.generic_payment_id is not None:
|
||||
hosting_order_str += " - Generic Payment"
|
||||
if self.stripe_charge_id is not None:
|
||||
hosting_order_str += " - One time charge"
|
||||
else:
|
||||
hosting_order_str += " - Recurring"
|
||||
return hosting_order_str
|
||||
|
||||
@cached_property
|
||||
def status(self):
|
||||
|
|
Loading…
Reference in a new issue