aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack/organisations/views.py')
-rw-r--r--ctrack/organisations/views.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py
index ae98305..1d1978e 100644
--- a/ctrack/organisations/views.py
+++ b/ctrack/organisations/views.py
@@ -1,6 +1,7 @@
import itertools
from typing import Any
+from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db import transaction
from django.db.models import Q
@@ -28,6 +29,18 @@ def essential_service_detail(request, pk):
return render(request, "organisations/essential_service_detail.html", context)
+class OrganisationListViewByLeadInspector(ListView):
+ model = Organisation
+ template_name = "organisations/organisation_list.html"
+
+ def get_context_data(self, *, object_list=None, **kwargs):
+ context = super().get_context_data(**kwargs)
+ inspector = get_user_model().objects.get(id=self.kwargs.get("id"))
+ context["organisation_list"] = Organisation.objects.filter(lead_inspector=inspector)
+ context["inspector"] = inspector
+ return context
+
+
class PersonListView(PermissionRequiredMixin, ListView):
model = Person
template_name = "organisations/person_list.html"