2016-12-20 23:05:20 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2017-02-15 04:34:06 +00:00
|
|
|
|
2017-07-26 17:38:38 +00:00
|
|
|
class VMTemplate(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
2017-07-26 18:35:12 +00:00
|
|
|
opennebula_vm_template_id = models.IntegerField()
|
2017-07-26 17:38:38 +00:00
|
|
|
|
|
|
|
@classmethod
|
2017-07-26 18:35:12 +00:00
|
|
|
def create(cls, name, opennebula_vm_template_id):
|
2017-08-27 07:49:05 +00:00
|
|
|
vm_template = cls(
|
|
|
|
name=name, opennebula_vm_template_id=opennebula_vm_template_id)
|
2017-07-26 17:38:38 +00:00
|
|
|
return vm_template
|
2017-08-16 22:52:23 +00:00
|
|
|
|
|
|
|
|
2018-04-05 22:51:44 +00:00
|
|
|
class VMPricing(models.Model):
|
|
|
|
name = models.CharField(max_length=255, unique=True)
|
|
|
|
vat_inclusive = models.BooleanField(default=True)
|
2018-04-09 19:17:48 +00:00
|
|
|
vat_percentage = models.DecimalField(
|
|
|
|
max_digits=7, decimal_places=2, blank=True, default=0
|
|
|
|
)
|
|
|
|
cores_unit_price = models.DecimalField(
|
|
|
|
max_digits=7, decimal_places=2, default=0
|
|
|
|
)
|
|
|
|
ram_unit_price = models.DecimalField(
|
|
|
|
max_digits=7, decimal_places=2, default=0
|
|
|
|
)
|
|
|
|
ssd_unit_price = models.DecimalField(
|
|
|
|
max_digits=7, decimal_places=2, default=0
|
|
|
|
)
|
|
|
|
hdd_unit_price = models.DecimalField(
|
|
|
|
max_digits=7, decimal_places=2, default=0
|
|
|
|
)
|
2018-04-05 22:51:44 +00:00
|
|
|
|
|
|
|
def __str__(self):
|
2018-04-09 19:17:48 +00:00
|
|
|
return self.name + '-' + 'VAT' if self.vat_inclusive else 'NO_VAT'
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def get_default_pricing(cls):
|
|
|
|
""" Returns the default pricing or None """
|
|
|
|
try:
|
|
|
|
default_pricing = VMPricing.objects.get(name='default')
|
|
|
|
except:
|
|
|
|
default_pricing = None
|
|
|
|
return default_pricing
|
2018-04-05 22:51:44 +00:00
|
|
|
|
|
|
|
|
2017-08-16 22:52:23 +00:00
|
|
|
class StripePlan(models.Model):
|
|
|
|
"""
|
|
|
|
A model to store Data Center Light's created Stripe plans
|
|
|
|
"""
|
2017-08-21 20:25:45 +00:00
|
|
|
stripe_plan_id = models.CharField(max_length=256, null=True)
|
2017-08-16 22:52:23 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def create(cls, stripe_plan_id):
|
|
|
|
stripe_plan = cls(stripe_plan_id=stripe_plan_id)
|
|
|
|
return stripe_plan
|
2017-08-27 07:49:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ContactUs(models.Model):
|
|
|
|
name = models.CharField(max_length=250)
|
|
|
|
email = models.CharField(max_length=250)
|
|
|
|
message = models.TextField()
|
|
|
|
field = models.DateTimeField(auto_now_add=True)
|
2018-02-27 22:39:19 +00:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|