aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-03-03 10:14:10 +0000
committerMatthew Lemon <matt@matthewlemon.com>2020-03-03 10:14:10 +0000
commit2dd771d6c28fb0f577d896360fa13cc7e3d8a670 (patch)
tree66ef97550bacd25b697e9ebe6a618c8139b59236
parentf3b1b1cea0cce4794cefc421f2c9b0976423b0b6 (diff)
first stab at doing an essential services list page
-rw-r--r--ctrack/caf/templates/caf/essentialservice_list.html36
-rw-r--r--ctrack/caf/urls.py3
-rw-r--r--ctrack/caf/views.py14
3 files changed, 52 insertions, 1 deletions
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 %}
+<div class="container">
+ <div class="row">
+ <div class="col-sm-12">
+ <h1>Essential Services</h1>
+
+ <table class="table table-striped">
+ <thead>
+ <tr>
+ <th>Organisation</th>
+ <th>Essential Service</th>
+ <th>Review Inspector</th>
+ </tr>
+ </thead>
+ {% for es in object_list %}
+ <tr>
+ <td>{{ es.organisation.name }}</td>
+ <td>{{ es.name }}</td>
+ <td>{{ es.caf.triage_review_inspector.name }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+
+ </div>
+ </div>
+</div>
+
+{% 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
+
+