[vm] add disks inlined to VMs
This commit is contained in:
parent
f7b14bf507
commit
c9a941e290
2 changed files with 13 additions and 4 deletions
|
@ -3,5 +3,13 @@ from django.contrib import admin
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
from uncloud_vm.models import *
|
from uncloud_vm.models import *
|
||||||
|
|
||||||
admin.site.register(VMProduct)
|
class VMDiskInline(admin.TabularInline):
|
||||||
|
model = VMDiskProduct
|
||||||
|
|
||||||
|
class VMProductAdmin(admin.ModelAdmin):
|
||||||
|
inlines = [
|
||||||
|
VMDiskInline,
|
||||||
|
]
|
||||||
|
|
||||||
|
admin.site.register(VMProduct, VMProductAdmin)
|
||||||
admin.site.register(VMDiskProduct)
|
admin.site.register(VMDiskProduct)
|
||||||
|
|
|
@ -163,9 +163,10 @@ class VMDiskProduct(Product):
|
||||||
choices=VMDiskType.choices,
|
choices=VMDiskType.choices,
|
||||||
default=VMDiskType.CEPH_SSD)
|
default=VMDiskType.CEPH_SSD)
|
||||||
|
|
||||||
@property
|
def __str__(self):
|
||||||
def description(self):
|
return "{} disk for VM '{}': {}GB".format(self.disk_type,
|
||||||
return "Disk for VM '{}': {}GB".format(self.vm.name, self.size_in_gb)
|
self.vm.name,
|
||||||
|
self.size_in_gb)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def recurring_price(self):
|
def recurring_price(self):
|
||||||
|
|
Loading…
Reference in a new issue