aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-17 14:46:23 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-17 14:46:23 +0100
commitc1a64fc08f7e21c5c0933f09c665ff5a25dd8868 (patch)
treec729e128233070125280dcf550f86dbc59d06088 /ctrack/caf
parent59592232da815f4e8c6f61cb9042e738990c1b6e (diff)
replaced all LoginRequiredMixin and decorators with custom middleware
Diffstat (limited to 'ctrack/caf')
-rw-r--r--ctrack/caf/views.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py
index f748b49..a5d9953 100644
--- a/ctrack/caf/views.py
+++ b/ctrack/caf/views.py
@@ -11,13 +11,12 @@ from ctrack.caf.models import CAF, ApplicableSystem
from ctrack.organisations.models import Organisation
-class ListCAF(LoginRequiredMixin, PermissionRequiredMixin, ListView):
+class ListCAF(PermissionRequiredMixin, ListView):
model = CAF
permission_required = "caf.view_caf"
# Let's write a traditional function view!
-@login_required()
@permission_required("caf.view_caf")
def caf_detail_view(request, pk):
caf = CAF.objects.get(pk=pk)
@@ -39,7 +38,7 @@ def caf_detail_view(request, pk):
return render(request, "caf/caf_detail.html", context)
-class ListApplicableSystem(LoginRequiredMixin, PermissionRequiredMixin, ListView):
+class ListApplicableSystem(PermissionRequiredMixin, ListView):
model = ApplicableSystem
# apparently you can pass a list of model objects to a template if you name it
# here - otherwise you need to provide a QuerySet
@@ -55,7 +54,7 @@ class ListApplicableSystem(LoginRequiredMixin, PermissionRequiredMixin, ListView
return context
-class ApplicableSystemDetail(LoginRequiredMixin, PermissionRequiredMixin, DetailView):
+class ApplicableSystemDetail(PermissionRequiredMixin, DetailView):
model = ApplicableSystem
template_name = "caf/applicablesystem_detail.html"
permission_required = "caf.view_applicablesystem"
@@ -88,8 +87,7 @@ def applicable_system_create_from_caf(request, caf_id):
)
-class ApplicableSystemCreateFromOrg(
- LoginRequiredMixin, PermissionRequiredMixin, FormView
+class ApplicableSystemCreateFromOrg(PermissionRequiredMixin, FormView
):
form_class = ApplicableSystemCreateFromOrgForm
template_name = "caf/applicable_system_create_from_org.html"