From 8e843075adc31359703838e23e53b17ffa8e9f9c Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Fri, 4 Sep 2020 16:14:59 +0100 Subject: linking up essential service, ass and org detail html --- .../caf/templates/caf/applicablesystem_detail.html | 2 +- .../organisations/essential_service_detail.html | 33 ++++++++++++++++++++++ .../organisations/organisation_detail.html | 2 +- ctrack/organisations/urls.py | 6 ++++ ctrack/organisations/views.py | 9 ++++++ 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 ctrack/organisations/templates/organisations/essential_service_detail.html (limited to 'ctrack') diff --git a/ctrack/caf/templates/caf/applicablesystem_detail.html b/ctrack/caf/templates/caf/applicablesystem_detail.html index b8467b0..fa1d414 100644 --- a/ctrack/caf/templates/caf/applicablesystem_detail.html +++ b/ctrack/caf/templates/caf/applicablesystem_detail.html @@ -24,7 +24,7 @@
diff --git a/ctrack/organisations/templates/organisations/essential_service_detail.html b/ctrack/organisations/templates/organisations/essential_service_detail.html new file mode 100644 index 0000000..1fd17bb --- /dev/null +++ b/ctrack/organisations/templates/organisations/essential_service_detail.html @@ -0,0 +1,33 @@ +{% extends "base.html" %} + +{% block title %} + {{ es.name }} +{% endblock %} + +{% block content %} +
+
+
+
+
+

{{ es.name }}

+
+
+
+
+
+
+

{{ es.description }}

+
+
+
+
+ +
+
+ +{% endblock content %} diff --git a/ctrack/organisations/templates/organisations/organisation_detail.html b/ctrack/organisations/templates/organisations/organisation_detail.html index a86adf1..e05d33d 100644 --- a/ctrack/organisations/templates/organisations/organisation_detail.html +++ b/ctrack/organisations/templates/organisations/organisation_detail.html @@ -76,7 +76,7 @@ {% if applicable_systems|length > 0 %} {% for es in essential_services %} - {{ es.name }} + {{ es.name }} {{ es.description }}
| Edit System diff --git a/ctrack/organisations/urls.py b/ctrack/organisations/urls.py index 95967c6..ba13465 100644 --- a/ctrack/organisations/urls.py +++ b/ctrack/organisations/urls.py @@ -6,6 +6,7 @@ from ctrack.organisations.views import ( OrganisationDetailView, OrganisationListView, PersonListView, + essential_service_detail, ) app_name = "organisations" @@ -20,5 +21,10 @@ urlpatterns = [ ), path("", view=OrganisationListView.as_view(), name="list"), path("create", view=OrganisationCreate.as_view(), name="create"), + path( + "essentialservice/", + essential_service_detail, + name="essential_service_detail", + ), # path("create", view=OrganisationCreate.as_view(), name="create") ] diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py index 7652783..eb264ca 100644 --- a/ctrack/organisations/views.py +++ b/ctrack/organisations/views.py @@ -1,6 +1,7 @@ from typing import Any, Dict from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from django.shortcuts import render, get_object_or_404 from django.db import transaction from django.http import HttpResponseRedirect from django.urls import reverse, reverse_lazy @@ -12,6 +13,14 @@ from .forms import AddressInlineFormSet, IncidentReportForm, OrganisationCreateF from .models import IncidentReport, Organisation, Person from ctrack.caf.models import EssentialService +# TODO - needs a permission on this view +def essential_service_detail(request, pk): + es = EssentialService.objects.get(pk=pk) + asses = es.systems.all() + # es = get_object_or_404(EssentialService, organisation__pk=org_pk) + context = {"es": es, "asses": asses} + return render(request, "organisations/essential_service_detail.html", context) + class PersonListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): model = Person -- cgit v1.2.3