From edf4c59212c757d81a51fbc8d587bb7384d921fa Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Fri, 18 Sep 2020 15:26:53 -0400 Subject: 3 contact us buttons and booking links on landing Signed-off-by: Sean Smith Change-Id: Ic50767e566f06d34457b6543644eeee03e584b89 --- src/dashboard/views.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/dashboard/views.py') diff --git a/src/dashboard/views.py b/src/dashboard/views.py index 2ace2d4..f9a908c 100644 --- a/src/dashboard/views.py +++ b/src/dashboard/views.py @@ -12,8 +12,12 @@ from django.shortcuts import get_object_or_404 from django.views.generic import TemplateView from django.shortcuts import render +from django.db.models import Q +from datetime import datetime +import pytz from account.models import Lab +from booking.models import Booking from resource_inventory.models import Image, ResourceProfile, ResourceQuery from workflow.workflow_manager import ManagerTracker @@ -65,12 +69,22 @@ def host_profile_detail_view(request): def landing_view(request): manager = ManagerTracker.managers.get(request.session.get('manager_session')) + user = request.user + if not user.is_anonymous: + bookings = Booking.objects.filter( + Q(owner=user) | Q(collaborators=user), + end__gte=datetime.now(pytz.utc) + ) + else: + bookings = None + return render( request, 'dashboard/landing.html', { 'manager': manager is not None, - 'title': "Welcome to the Lab as a Service Dashboard" + 'title': "Welcome to the Lab as a Service Dashboard", + 'bookings': bookings } ) -- cgit 1.2.3-korg