diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-09-04 16:14:59 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-09-04 16:14:59 +0100 |
commit | 8e843075adc31359703838e23e53b17ffa8e9f9c (patch) | |
tree | b5504c70f0076d3bf53dc47991c0a690e4942ed3 /ctrack | |
parent | 959c001905fffc4840e8f795170d724474bc1997 (diff) |
linking up essential service, ass and org detail html
Diffstat (limited to 'ctrack')
5 files changed, 50 insertions, 2 deletions
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 @@ <div class="row"> <ul> {% for s in object.essentialservice_set.all %} - <li>{{ s.name }}</li> + <li><a href="{% url "organisations:essential_service_detail" s.pk %}">{{ s.name }}</a></li> {% endfor %} </ul> </div> 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 %} + <div class="container mt-3"> + <div class="row"> + <div class="col-sm-12 pl-0 my-2"> + <div class="row"> + <div class="col-12"> + <h4>{{ es.name }}</h4> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12 pl-0 my-2"> + <p>{{ es.description }}</p> + </div> + </div> + <div class="row"> + <div class="col-sm-12 pl-0 my-2"> + <ul> + {% for ass in asses %} + <li><a href="{% url "caf:ass_detail" ass.pk %}">{{ ass.name }}</a></li> + {% endfor %} + </ul> + </div> + </div> + +{% 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 %} <tr> - <td style="width: 18%">{{ es.name }}</td> + <td style="width: 18%"><a href="{% url "organisations:essential_service_detail" es.pk %}">{{ es.name }}</a></td> <td>{{ es.description }}<br> <span class="text-muted"> | <a href="#" class="small">Edit System</a></span> </td> 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/<int:pk>", + 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 |