aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrack/caf/views.py4
-rw-r--r--ctrack/organisations/models.py10
-rw-r--r--ctrack/organisations/templates/organisations/organisation_detail.html2
-rw-r--r--ctrack/organisations/views.py2
4 files changed, 8 insertions, 10 deletions
diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py
index 4dbde02..aaeb90b 100644
--- a/ctrack/caf/views.py
+++ b/ctrack/caf/views.py
@@ -115,8 +115,8 @@ class ApplicableSystemCreateFromOrg(
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
org = Organisation.objects.get(slug=self.kwargs["slug"])
- asses = org.applicablesystem_set.all()
- org_cafs = {ass.caf for ass in asses}
+ asses = org.applicable_systems()
+ org_cafs = org.caf_set.all()
kwargs["org_id"] = org.id
kwargs["slug"] = org.slug
kwargs["org_name"] = org.name
diff --git a/ctrack/organisations/models.py b/ctrack/organisations/models.py
index 1c914b5..f91dabf 100644
--- a/ctrack/organisations/models.py
+++ b/ctrack/organisations/models.py
@@ -153,20 +153,18 @@ class Organisation(models.Model):
return self.person_set.filter(primary_nis_contact=True)
def applicable_systems(self):
- return self.applicablesystem_set.all()
-
- def systems(self):
+ # return self.applicablesystem_set.all()
ess = self.essentialservice_set.all()
out = []
for es in ess:
- out.extend(list(es.systems.all()))
+ out.extend(es.systems.all())
return out
- def systems_for_each_essential_service(self):
+ def systems(self):
ess = self.essentialservice_set.all()
out = []
for es in ess:
- out.extend(es.systems.all())
+ out.extend(list(es.systems.all()))
return out
diff --git a/ctrack/organisations/templates/organisations/organisation_detail.html b/ctrack/organisations/templates/organisations/organisation_detail.html
index 0e981b9..9ece192 100644
--- a/ctrack/organisations/templates/organisations/organisation_detail.html
+++ b/ctrack/organisations/templates/organisations/organisation_detail.html
@@ -79,7 +79,7 @@
<tr>
<td><a href="{% url "caf:ass_detail" ass.id %}">{{ ass.name }}</a></td>
<td>{{ ass.function }}<br>
- <a href="{% url "caf:detail" ass.caf.pk %}" class="small">
+ <a href="{% url "caf:detail" ass.pk %}" class="small">
{{ ass.caf }}
</a> <span class="text-muted"> | <a href="#" class="small">Edit System</a></span>
</td>
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py
index 3f91e2f..7652783 100644
--- a/ctrack/organisations/views.py
+++ b/ctrack/organisations/views.py
@@ -79,7 +79,7 @@ class OrganisationDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detail
context["addr"] = addr
people = org.person_set.all()
context["people"] = people
- applicable_systems = org.systems_for_each_essential_service()
+ applicable_systems = org.applicable_systems()
context["applicable_systems"] = applicable_systems
context["engagement_events"] = engagement_events
context["essential_services"] = essential_services