diff --git a/datacenterlight/utils.py b/datacenterlight/utils.py index 3d0e4370..a6f760af 100644 --- a/datacenterlight/utils.py +++ b/datacenterlight/utils.py @@ -1,7 +1,7 @@ from django.contrib.sites.models import Site from datacenterlight.tasks import create_vm_task -from hosting.models import HostingOrder, HostingBill, OrderSpecifications +from hosting.models import HostingOrder, HostingBill, OrderDetail from membership.models import StripeCustomer from utils.forms import UserBillingAddressForm from utils.models import BillingAddress @@ -53,13 +53,13 @@ def create_vm(billing_address_data, stripe_customer_id, specs, vm_pricing=vm_pricing ) - order_specs_obj, obj_created = OrderSpecifications.objects.get_or_create( + order_detail_obj, obj_created = OrderDetail.objects.get_or_create( vm_template=VMTemplate.objects.get( opennebula_vm_template_id=vm_template_id ), cores=specs['cpu'], memory=specs['memory'], ssd_size=specs['disk_size'] ) - order.order_specs = order_specs_obj + order.order_detail = order_detail_obj order.save() # Create a Hosting Bill diff --git a/hosting/migrations/0045_auto_20180701_1718.py b/hosting/migrations/0045_auto_20180701_2028.py similarity index 89% rename from hosting/migrations/0045_auto_20180701_1718.py rename to hosting/migrations/0045_auto_20180701_2028.py index d9705a24..39b58aa8 100644 --- a/hosting/migrations/0045_auto_20180701_1718.py +++ b/hosting/migrations/0045_auto_20180701_2028.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.4 on 2018-07-01 17:18 +# Generated by Django 1.9.4 on 2018-07-01 20:28 from __future__ import unicode_literals from django.db import migrations, models @@ -16,7 +16,7 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='OrderSpecifications', + name='OrderDetail', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('cores', models.IntegerField(default=0)), @@ -29,7 +29,7 @@ class Migration(migrations.Migration): ), migrations.AddField( model_name='hostingorder', - name='order_specs', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='hosting.OrderSpecifications'), + name='order_detail', + field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='hosting.OrderDetail'), ), ] diff --git a/hosting/models.py b/hosting/models.py index 2ce604d0..411bd267 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -41,7 +41,7 @@ class HostingPlan(models.Model): return price -class OrderSpecifications(AssignPermissionsMixin, models.Model): +class OrderDetail(AssignPermissionsMixin, models.Model): vm_template = models.ForeignKey( VMTemplate, blank=True, null=True, default=None, on_delete=models.SET_NULL @@ -73,8 +73,8 @@ class HostingOrder(AssignPermissionsMixin, models.Model): price = models.FloatField() subscription_id = models.CharField(max_length=100, null=True) vm_pricing = models.ForeignKey(VMPricing) - order_specs = models.ForeignKey( - OrderSpecifications, null=True, blank=True, default=None, + order_detail = models.ForeignKey( + OrderDetail, null=True, blank=True, default=None, on_delete=models.SET_NULL )