aboutsummaryrefslogtreecommitdiffstats
path: root/src/booking/views.py
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2019-08-29 16:35:53 +0000
committerGerrit Code Review <gerrit@opnfv.org>2019-08-29 16:35:53 +0000
commit01bdb95d22840393a20378559cf3cf59c4bdce78 (patch)
tree7880970eb7f55c2e9a6af7ada2ee5900cac9e2be /src/booking/views.py
parent99f96e86bdf78e9d93ad1d259fc18e3fff772720 (diff)
parentd78fcef6ec55dbaa225c6607bdac430539bf3f0b (diff)
Merge "Adds Downtime Awareness"
Diffstat (limited to 'src/booking/views.py')
-rw-r--r--src/booking/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/booking/views.py b/src/booking/views.py
index bad7dc9..8e25952 100644
--- a/src/booking/views.py
+++ b/src/booking/views.py
@@ -20,7 +20,7 @@ from django.urls import reverse
from resource_inventory.models import ResourceBundle, HostProfile, Image, Host
from resource_inventory.resource_manager import ResourceManager
-from account.models import Lab
+from account.models import Lab, Downtime
from booking.models import Booking
from booking.stats import StatisticsManager
from booking.forms import HostReImageForm
@@ -79,8 +79,9 @@ class BookingView(TemplateView):
def get_context_data(self, **kwargs):
booking = get_object_or_404(Booking, id=self.kwargs['booking_id'])
title = 'Booking Details'
+ downtime = Downtime.objects.filter(lab=booking.lab, start__lt=timezone.now, end__gt=timezone.now()).first()
context = super(BookingView, self).get_context_data(**kwargs)
- context.update({'title': title, 'booking': booking})
+ context.update({'title': title, 'booking': booking, 'downtime': downtime})
return context