aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations/views.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-20 15:57:26 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-20 15:57:26 +0100
commit30d2bf6d91e625d08c38800d1b1819d90dfe7f1e (patch)
treed310a7d569c1449d419329a08f327129c23002c3 /ctrack/organisations/views.py
parent98f6ce0fa2ce5692f578a98922f50aa79fd46bdd (diff)
poor implementation of lead and deputy inspectors by submode on home page
Diffstat (limited to '')
-rw-r--r--ctrack/organisations/views.py22
1 files changed, 2 insertions, 20 deletions
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py
index 82347e6..ae98305 100644
--- a/ctrack/organisations/views.py
+++ b/ctrack/organisations/views.py
@@ -1,5 +1,5 @@
import itertools
-from typing import Any, Dict, List, Set
+from typing import Any
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db import transaction
@@ -13,7 +13,7 @@ from ctrack.caf.models import CAF, EssentialService
from ctrack.register.models import EngagementEvent
from .forms import AddressInlineFormSet, IncidentReportForm, OrganisationCreateForm
-from .models import IncidentReport, Organisation, Person, Submode
+from .models import IncidentReport, Organisation, Person
from .utils import filter_private_events
@@ -143,21 +143,3 @@ class IncidentReportCreateView(FormView):
def form_valid(self, form):
form.save()
return HttpResponseRedirect(reverse("core:home"))
-
-
-def inspectors_for_each_mode(lead_type="lead_inspector") -> Dict[str, Set[str]]:
- """
- We want to be able to group lead inspectors by submode.
- """
- if lead_type not in ["lead_inspector", "deputy_lead_inspector"]:
- raise ValueError("Can only query for lead_inspector and deputy_lead_inspector attributes.")
- submodes = Submode.objects.all()
- out = {}
- for sm in submodes:
- insp = set()
- orgs = sm.organisation_set.all()
- for org in orgs:
- insp.add(getattr(org, lead_type))
- out[sm.descriptor] = insp
- del insp
- return out