forked from uncloud/uncloud
[storage] move choices to uncloud_storage
This commit is contained in:
parent
ec7a2a3c3a
commit
66e224e926
2 changed files with 12 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
|||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class StorageClass(models.TextChoices):
|
||||
HDD = 'HDD', _('HDD')
|
||||
SSD = 'SSD', _('SSD')
|
||||
|
|
|
@ -8,6 +8,7 @@ from django.contrib.auth import get_user_model
|
|||
|
||||
from uncloud_pay.models import Product, RecurringPeriod
|
||||
import uncloud_pay.models as pay_models
|
||||
import uncloud_storage.models
|
||||
|
||||
STATUS_CHOICES = (
|
||||
('pending', 'Pending'), # Initial state
|
||||
|
@ -52,9 +53,9 @@ class VMProduct(Product):
|
|||
VMHost, on_delete=models.CASCADE, editable=False, blank=True, null=True
|
||||
)
|
||||
|
||||
# VM-specific. The name is only intended for customers: it's a pain te
|
||||
# VM-specific. The name is only intended for customers: it's a pain to
|
||||
# remember IDs (speaking from experience as ungleich customer)!
|
||||
name = models.CharField(max_length=32)
|
||||
name = models.CharField(max_length=32, blank=True, null=True)
|
||||
cores = models.IntegerField()
|
||||
ram_in_gb = models.FloatField()
|
||||
vmid = models.IntegerField(null=True)
|
||||
|
@ -106,14 +107,10 @@ class VMDiskImageProduct(models.Model):
|
|||
import_url = models.URLField(null=True, blank=True)
|
||||
image_source = models.CharField(max_length=128, null=True)
|
||||
image_source_type = models.CharField(max_length=128, null=True)
|
||||
storage_class = models.CharField(
|
||||
max_length=32,
|
||||
choices=(
|
||||
('hdd', 'HDD'),
|
||||
('ssd', 'SSD'),
|
||||
),
|
||||
default='ssd'
|
||||
)
|
||||
|
||||
storage_class = models.CharField(max_length=32,
|
||||
choices = uncloud_storage.models.StorageClass.choices,
|
||||
default = uncloud_storage.models.StorageClass.SSD)
|
||||
|
||||
status = models.CharField(
|
||||
max_length=32, choices=STATUS_CHOICES, default=STATUS_DEFAULT
|
||||
|
|
Loading…
Reference in a new issue