added missing/incomplete permissions to views
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
|
||||
from django.shortcuts import render, redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils import timezone
|
||||
@@ -13,11 +14,14 @@ from preinfo.models import Preinfo
|
||||
|
||||
|
||||
# Create your views here.
|
||||
class ContainerReceiveView(FormView):
|
||||
class ContainerReceiveView(LoginRequiredMixin, UserPassesTestMixin, FormView):
|
||||
template_name = 'container-receive.html'
|
||||
form_class = ContainerReceiveForm
|
||||
success_url = reverse_lazy('container_photos')
|
||||
|
||||
def test_func(self):
|
||||
return self.request.user.user_type == 'BS'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['show_search'] = True
|
||||
@@ -179,11 +183,14 @@ class ContainerSearchView(View):
|
||||
# # return redirect(reverse_lazy('container_search'))
|
||||
|
||||
|
||||
class ContainerExpedition(FormView):
|
||||
class ContainerExpedition(LoginRequiredMixin, UserPassesTestMixin, FormView):
|
||||
template_name = 'container-expedition.html'
|
||||
form_class = ContainerExpeditionForm
|
||||
success_url = reverse_lazy('barrier_dashboard')
|
||||
|
||||
def test_func(self):
|
||||
return self.request.user.user_type == 'BS'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['show_search'] = True
|
||||
|
||||
Reference in New Issue
Block a user