add endTime property, automatically calculated from StartTime + Duration
diff --git a/planetstack/core/models/reservation.py b/planetstack/core/models/reservation.py
index 1a41ee5..4aeaadd 100644
--- a/planetstack/core/models/reservation.py
+++ b/planetstack/core/models/reservation.py
@@ -1,4 +1,5 @@
import os
+import datetime
from django.db import models
from core.models import PlCoreBase
from core.models import Sliver
@@ -14,6 +15,10 @@
def __unicode__(self): return u'%s duration %d' % (self.startTime, self.duration)
+ @property
+ def endTime(self):
+ return self.startTime + datetime.timedelta(hours=self.duration)
+
class ReservedResource(PlCoreBase):
sliver = models.ForeignKey(Sliver, related_name="reservedResourrces")
resource = models.ForeignKey(ServiceResource, related_name="reservedResources")