Commit b868a05c by Guba Sándor

storage: fixed #105 changed ready to property

parent 33415e82
...@@ -5,7 +5,7 @@ import logging ...@@ -5,7 +5,7 @@ import logging
from os.path import join from os.path import join
import uuid import uuid
from django.db.models import (Model, BooleanField, CharField, DateTimeField, from django.db.models import (Model, CharField, DateTimeField,
ForeignKey) ForeignKey)
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -74,8 +74,6 @@ class Disk(AclBase, TimeStampedModel): ...@@ -74,8 +74,6 @@ class Disk(AclBase, TimeStampedModel):
size = FileSizeField() size = FileSizeField()
base = ForeignKey('self', blank=True, null=True, base = ForeignKey('self', blank=True, null=True,
related_name='derivatives') related_name='derivatives')
ready = BooleanField(default=False,
help_text=_("The associated resource is ready."))
dev_num = CharField(default='a', max_length=1, dev_num = CharField(default='a', max_length=1,
verbose_name=_("device number")) verbose_name=_("device number"))
destroyed = DateTimeField(blank=True, default=None, null=True) destroyed = DateTimeField(blank=True, default=None, null=True)
...@@ -109,6 +107,10 @@ class Disk(AclBase, TimeStampedModel): ...@@ -109,6 +107,10 @@ class Disk(AclBase, TimeStampedModel):
self.disk = disk self.disk = disk
@property @property
def ready(self):
return self.activity_log.filter(activity_code__endswith="deploy",
succeeded__isnull=False)
def path(self): def path(self):
"""The path where the files are stored. """The path where the files are stored.
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment