Added admin user to people who can access bookings 31/74131/2
authorNicholas Schoenfeld <nschoenfeld@d122195.iol.unh.edu>
Fri, 22 Sep 2023 15:34:18 +0000 (11:34 -0400)
committernschoenfeld <nschoenfeld@iol.unh.edu>
Thu, 28 Sep 2023 19:18:13 +0000 (15:18 -0400)
Change-Id: Ib226f354caf1b8b357dc106ca58224dd20ad2c1d
Signed-off-by: Nicholas Schoenfeld <nschoenfeld@iol.unh.edu>
src/booking/views.py

index c99e2c2..c6df8a1 100644 (file)
@@ -8,7 +8,7 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
-from django.contrib import messages
+from django.contrib import messages, admin
 from django.shortcuts import get_object_or_404
 from django.http import JsonResponse, HttpResponse
 from django.utils import timezone
@@ -80,10 +80,11 @@ def booking_detail_view(request, booking_id):
     booking = get_object_or_404(Booking, id=booking_id)
     statuses = get_booking_status(booking)
     allowed_users = set(list(booking.collaborators.all()))
+    if (request.user.is_superuser):
+        allowed_users.add(request.user)
     allowed_users.add(booking.owner)
     if user not in allowed_users:
         return render(request, "dashboard/login.html", {'title': 'This page is private'})
-    
     context = {
         'title': 'Booking Details',
         'booking': booking,