added missing/incomplete permissions to views
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user