From 2dd771d6c28fb0f577d896360fa13cc7e3d8a670 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 3 Mar 2020 10:14:10 +0000 Subject: first stab at doing an essential services list page --- .../caf/templates/caf/essentialservice_list.html | 36 ++++++++++++++++++++++ ctrack/caf/urls.py | 3 +- ctrack/caf/views.py | 14 +++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 ctrack/caf/templates/caf/essentialservice_list.html diff --git a/ctrack/caf/templates/caf/essentialservice_list.html b/ctrack/caf/templates/caf/essentialservice_list.html new file mode 100644 index 0000000..35f0aa5 --- /dev/null +++ b/ctrack/caf/templates/caf/essentialservice_list.html @@ -0,0 +1,36 @@ +{% extends "base.html" %} + +{% load static %} + +{% block title %}Essential Services{% endblock %} +{% block content %} +
+
+
+

Essential Services

+ + + + + + + + + + {% for es in object_list %} + + + + + + {% endfor %} +
OrganisationEssential ServiceReview Inspector
{{ es.organisation.name }}{{ es.name }}{{ es.caf.triage_review_inspector.name }}
+ +
+
+
+ +{% endblock content %} + + + diff --git a/ctrack/caf/urls.py b/ctrack/caf/urls.py index 0f42a40..9603db5 100644 --- a/ctrack/caf/urls.py +++ b/ctrack/caf/urls.py @@ -1,10 +1,11 @@ from django.urls import path -from ctrack.caf.views import CreateCAF, ListCAF +from ctrack.caf.views import CreateCAF, ListCAF, ListEssentialService app_name = "caf" urlpatterns = [ path("", view=CreateCAF.as_view(), name="create"), path("", view=ListCAF.as_view(), name="caf_list"), + path("essentialservices", view=ListEssentialService.as_view(), name="es_list") ] diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py index d20b503..405fa0e 100644 --- a/ctrack/caf/views.py +++ b/ctrack/caf/views.py @@ -1,6 +1,7 @@ from django.views.generic import CreateView, ListView from ctrack.caf.forms import CAFForm +from ctrack.caf.models import EssentialService class CreateCAF(CreateView): @@ -16,3 +17,16 @@ class CreateCAF(CreateView): class ListCAF(ListView): pass + +class ListEssentialService(ListView): + model = EssentialService + + def get_queryset(self): + ess = EssentialService.objects.all().order_by("organisation__name") + return ess + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + return context + + -- cgit v1.2.3