diff options
-rw-r--r-- | src/booking/views.py | 4 | ||||
-rw-r--r-- | src/templates/booking/booking_table.html | 4 | ||||
-rw-r--r-- | src/templates/dashboard/multiple_select_filter_widget.html | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/booking/views.py b/src/booking/views.py index 9b9860f..a0ea31d 100644 --- a/src/booking/views.py +++ b/src/booking/views.py @@ -103,6 +103,10 @@ def booking_detail_view(request, booking_id): return render(request, "dashboard/login.html", {'title': 'Authentication Required'}) booking = get_object_or_404(Booking, id=booking_id) + allowed_users = set(list(booking.collaborators.all())) + allowed_users.add(booking.owner) + if user not in allowed_users: + return render(request, "dashboard/login.html", {'title': 'This page is private'}) return render(request, "booking/booking_detail.html", { 'title': 'Booking Details', 'booking': booking, diff --git a/src/templates/booking/booking_table.html b/src/templates/booking/booking_table.html index af2248c..5e82645 100644 --- a/src/templates/booking/booking_table.html +++ b/src/templates/booking/booking_table.html @@ -3,7 +3,7 @@ <thead> <tr> - <th>User</th> + <th>Owner</th> <th>Purpose</th> <th>Start</th> <th>End</th> @@ -16,7 +16,7 @@ {% for booking in bookings %} <tr> <td> - {{ booking.user.username }} + {{ booking.owner.username }} </td> <td> {{ booking.purpose }} diff --git a/src/templates/dashboard/multiple_select_filter_widget.html b/src/templates/dashboard/multiple_select_filter_widget.html index ed29ed6..31b8f33 100644 --- a/src/templates/dashboard/multiple_select_filter_widget.html +++ b/src/templates/dashboard/multiple_select_filter_widget.html @@ -337,6 +337,7 @@ function add_item_prepopulate(node, prepopulate){ button.appendChild(document.createTextNode("Remove")); div.appendChild(button); document.getElementById("dropdown_wrapper").appendChild(div); + updateObjectResult(div); return div; } |