added missing/incomplete permissions to views

This commit is contained in:
2025-08-03 11:52:01 +03:00
parent 13c4c324fc
commit 75b3adfc71
14 changed files with 103 additions and 153 deletions
+6 -7
View File
@@ -1,19 +1,18 @@
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.views.generic import ListView
from booking.models import Booking
class BookingListView(ListView):
class BookingListView(LoginRequiredMixin, UserPassesTestMixin, ListView):
template_name = 'employee/booking-list.html'
model = Booking
context_object_name = 'objects'
paginate_by = 20 # Number of containers per page
# base_template = 'employee-base.html'
paginate_by = 20
# def get_context_data(self, **kwargs):
# context = super().get_context_data(**kwargs)
# context['base_template'] = self.base_template
# return context
def test_func(self):
user = self.request.user
return self.request.user.user_type == 'EMP' or user.is_superuser
def get_queryset(self):
queryset = super().get_queryset()