mirror of
https://github.com/retspen/webvirtcloud.git
synced 2026-06-04 11:29:39 +00:00
Reworked some computes views and added more tests
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user