Link HostingBillLineItem to StripePlan

This commit is contained in:
PCoder 2019-04-20 12:41:30 +02:00
parent c8e35e63f0
commit 38d074811a
2 changed files with 27 additions and 2 deletions

View file

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2019-04-20 10:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0028_stripeplan_stripe_plan_name'),
('hosting', '0052_hostingbilllineitem'),
]
operations = [
migrations.AddField(
model_name='hostingbilllineitem',
name='stripe_plan',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='datacenterlight.StripePlan'),
),
]

View file

@ -10,7 +10,7 @@ from django.db import models
from django.utils import timezone from django.utils import timezone
from django.utils.functional import cached_property from django.utils.functional import cached_property
from datacenterlight.models import VMPricing, VMTemplate from datacenterlight.models import VMPricing, VMTemplate, StripePlan
from membership.models import StripeCustomer, CustomUser from membership.models import StripeCustomer, CustomUser
from utils.mixins import AssignPermissionsMixin from utils.mixins import AssignPermissionsMixin
from utils.models import BillingAddress from utils.models import BillingAddress
@ -431,7 +431,10 @@ class HostingBillLineItem(AssignPermissionsMixin, models.Model):
""" """
Corresponds to InvoiceItem object of Stripe Corresponds to InvoiceItem object of Stripe
""" """
monthly_hosting_bill = models.ForeignKey(MonthlyHostingBill) monthly_hosting_bill = models.ForeignKey(MonthlyHostingBill,
on_delete=models.CASCADE)
stripe_plan = models.ForeignKey(StripePlan, null=True,
on_delete=models.CASCADE)
amount = models.PositiveSmallIntegerField() amount = models.PositiveSmallIntegerField()
description = models.CharField(max_length=255) description = models.CharField(max_length=255)
discountable = models.BooleanField() discountable = models.BooleanField()