diff options
author | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2020-10-02 16:41:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2020-10-02 16:41:31 +0000 |
commit | 8a06cdd7d55fabcc71d7034481f7b83ee94611cd (patch) | |
tree | d863b2412ea99d954bc3b6e6eec544ef61cf7b68 /src/dashboard | |
parent | 836ba6a22ece7590c203c837669b73259f02540a (diff) | |
parent | edf4c59212c757d81a51fbc8d587bb7384d921fa (diff) |
Merge "3 contact us buttons and booking links on landing"
Diffstat (limited to 'src/dashboard')
-rw-r--r-- | src/dashboard/views.py | 16 |
1 files changed, 15 insertions, 1 deletions
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 } ) |