Rename OrderSpecifications to OrderDetail

This commit is contained in:
PCoder 2018-07-01 22:30:23 +02:00
parent 00cb1de75d
commit 44900f6a48
3 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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'),
),
]

View File

@ -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
)