forked from uncloud/uncloud
Commit WIP changes for /order, if needed at any point
This commit is contained in:
parent
809a55e1dd
commit
38d3a3a5d3
4 changed files with 61 additions and 57 deletions
|
|
@ -1,9 +1,10 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth import get_user_model
|
||||
import uuid
|
||||
|
||||
from uncloud_pay.models import Product, RecurringPeriod
|
||||
import uncloud_pay.models as pay_models
|
||||
from django.db import models
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
import uncloud_pay.models as paymodels
|
||||
import uncloud_pay.helpers as payhelpers
|
||||
|
||||
|
||||
class VMHost(models.Model):
|
||||
|
|
@ -33,7 +34,7 @@ class VMHost(models.Model):
|
|||
)
|
||||
|
||||
|
||||
class VMProduct(Product):
|
||||
class VMProduct(payhelpers.Product):
|
||||
vmhost = models.ForeignKey(VMHost,
|
||||
on_delete=models.CASCADE,
|
||||
editable=False,
|
||||
|
|
@ -45,8 +46,8 @@ class VMProduct(Product):
|
|||
ram_in_gb = models.FloatField()
|
||||
|
||||
@property
|
||||
def recurring_price(self, recurring_period=RecurringPeriod.PER_MONTH):
|
||||
if recurring_period == RecurringPeriod.PER_MONTH:
|
||||
def recurring_price(self, recurring_period=paymodels.RecurringPeriod.PER_MONTH):
|
||||
if recurring_period == paymodels.RecurringPeriod.PER_MONTH:
|
||||
# TODO: move magic numbers in variables
|
||||
return self.cores * 3 + self.ram_in_gb * 2
|
||||
else:
|
||||
|
|
@ -79,7 +80,7 @@ class VMNetworkCard(models.Model):
|
|||
mac_address = models.IntegerField()
|
||||
|
||||
|
||||
class VMSnapshotProduct(Product):
|
||||
class VMSnapshotProduct(payhelpers.Product):
|
||||
price_per_gb_ssd = 0.35
|
||||
price_per_gb_hdd = 1.5/100
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue