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
+9 -2
View File
@@ -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