From c92bf305144b744831c9e9eabd0e5ab0868cd109 Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 16 Apr 2018 03:23:09 +0200 Subject: [PATCH] Associate HostingOrder and VMPricing --- .../0044_hostingorder_vm_pricing.py | 23 +++++++++++++++++++ hosting/models.py | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 hosting/migrations/0044_hostingorder_vm_pricing.py diff --git a/hosting/migrations/0044_hostingorder_vm_pricing.py b/hosting/migrations/0044_hostingorder_vm_pricing.py new file mode 100644 index 00000000..ff36be3f --- /dev/null +++ b/hosting/migrations/0044_hostingorder_vm_pricing.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-04-16 00:22 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('datacenterlight', '0019_auto_20180415_2236'), + ('hosting', '0043_vmdetail'), + ] + + operations = [ + migrations.AddField( + model_name='hostingorder', + name='vm_pricing', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='datacenterlight.VMPricing'), + preserve_default=False, + ), + ] diff --git a/hosting/models.py b/hosting/models.py index 04f3ae30..de5732bc 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -6,6 +6,8 @@ from django.db import models from django.utils import timezone from django.utils.functional import cached_property from Crypto.PublicKey import RSA + +from datacenterlight.models import VMPricing from membership.models import StripeCustomer, CustomUser from utils.models import BillingAddress from utils.mixins import AssignPermissionsMixin @@ -53,6 +55,7 @@ class HostingOrder(AssignPermissionsMixin, models.Model): stripe_charge_id = models.CharField(max_length=100, null=True) price = models.FloatField() subscription_id = models.CharField(max_length=100, null=True) + vm_pricing = models.ForeignKey(VMPricing) permissions = ('view_hostingorder',)