add sample products and improve testing for Product
This commit is contained in:
parent
6a928a2b2a
commit
0dd1093812
4 changed files with 156 additions and 17 deletions
|
|
@ -69,16 +69,6 @@ class VMProduct(Product):
|
|||
def recurring_price(self):
|
||||
return self.cores * 3 + self.ram_in_gb * 4
|
||||
|
||||
def __str__(self):
|
||||
if self.name:
|
||||
name = f"{self.name} ({self.id})"
|
||||
else:
|
||||
name = self.id
|
||||
|
||||
return "VM {}: {} cores {} gb ram".format(name,
|
||||
self.cores,
|
||||
self.ram_in_gb)
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
return "Virtual machine '{}': {} core(s), {}GB memory".format(
|
||||
|
|
@ -92,6 +82,17 @@ class VMProduct(Product):
|
|||
RecurringPeriod.choices))
|
||||
|
||||
|
||||
def __str__(self):
|
||||
name = f"{self.id}"
|
||||
|
||||
if self.name:
|
||||
name = f"{self.id} ({self.name})"
|
||||
|
||||
return "VM {}: {} cores {} gb ram".format(name,
|
||||
self.cores,
|
||||
self.ram_in_gb)
|
||||
|
||||
|
||||
class VMWithOSProduct(VMProduct):
|
||||
primary_disk = models.ForeignKey('VMDiskProduct', on_delete=models.CASCADE, null=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue