mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Reworked some computes views and added more tests
This commit is contained in:
parent
68f7376d15
commit
a4d28f2953
8 changed files with 205 additions and 333 deletions
|
|
@ -1,6 +1,9 @@
|
|||
from django.db.models import Model, CharField, IntegerField
|
||||
from django.db.models import CharField, IntegerField, Model
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from vrtManager.connection import connection_manager
|
||||
|
||||
|
||||
class Compute(Model):
|
||||
name = CharField(_('name'), max_length=64, unique=True)
|
||||
|
|
@ -10,5 +13,9 @@ class Compute(Model):
|
|||
details = CharField(_('details'), max_length=64, null=True, blank=True)
|
||||
type = IntegerField()
|
||||
|
||||
@cached_property
|
||||
def status(self):
|
||||
return connection_manager.host_is_up(self.type, self.hostname)
|
||||
|
||||
def __str__(self):
|
||||
return self.hostname
|
||||
return self.name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue