Fix a bug when vm_template is None
This commit is contained in:
parent
ab074d9bc2
commit
f9584b4c82
1 changed files with 5 additions and 3 deletions
|
@ -53,9 +53,11 @@ class OrderDetail(AssignPermissionsMixin, models.Model):
|
||||||
ssd_size = models.IntegerField(default=0)
|
ssd_size = models.IntegerField(default=0)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s - %s, %s cores, %s GB RAM, %s GB SSD" % (
|
return "Not available" if self.vm_template is None else (
|
||||||
self.vm_template.name, self.vm_template.vm_type, self.cores,
|
"%s - %s, %s cores, %s GB RAM, %s GB SSD" % (
|
||||||
self.memory, self.ssd_size
|
self.vm_template.name, self.vm_template.vm_type, self.cores,
|
||||||
|
self.memory, self.ssd_size
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue