aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrack/caf/managers.py3
-rw-r--r--ctrack/caf/templates/caf/applicablesystem_list.html2
-rw-r--r--ctrack/caf/views.py12
3 files changed, 9 insertions, 8 deletions
diff --git a/ctrack/caf/managers.py b/ctrack/caf/managers.py
index 1323e38..b3f2e63 100644
--- a/ctrack/caf/managers.py
+++ b/ctrack/caf/managers.py
@@ -1,4 +1,5 @@
from django.db import models
+from django.db.models import QuerySet
from ctrack.organisations.models import Organisation, Person, Submode
import ctrack.caf.models # to deal with circular import
@@ -15,7 +16,7 @@ class ApplicableSystemManager(models.Manager):
cursor.execute("""
SELECT a.id, a.name, o.id, c.id, sm.id, p.id, o.name
FROM caf_applicablesystem a, organisations_organisation o, organisations_person p, caf_caf c, organisations_submode sm
- WHERE a.organisation_id = o.id AND a.caf_id = c.id AND p.organisation_id = o.id AND o.submode_id = sm.id AND p.primary_nis_contact = False;
+ WHERE a.organisation_id = o.id AND a.caf_id = c.id AND p.organisation_id = o.id AND o.submode_id = sm.id AND p.primary_nis_contact = True;
""")
result_list = []
for row in cursor.fetchall():
diff --git a/ctrack/caf/templates/caf/applicablesystem_list.html b/ctrack/caf/templates/caf/applicablesystem_list.html
index b1ba1a1..059b61e 100644
--- a/ctrack/caf/templates/caf/applicablesystem_list.html
+++ b/ctrack/caf/templates/caf/applicablesystem_list.html
@@ -19,6 +19,7 @@
<th class="tabaligncenter">Confidence Grade</th>
<th>Triage Review Date</th>
<th>Review Inspector</th>
+ <th>POC</th>
</tr>
</thead>
{% for sys in object_list %}
@@ -30,6 +31,7 @@
<td class="tabaligncenter">{{ sys.caf.confidence_grading.descriptor }}</td>
<td>{{ sys.caf.triage_review_date }}</td>
<td>{{ sys.caf.triage_review_inspector.name }}</td>
+ <td>{{ sys.nis_contact }}</td>
</tr>
{% endfor %}
</table>
diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py
index 23727d9..fceb869 100644
--- a/ctrack/caf/views.py
+++ b/ctrack/caf/views.py
@@ -20,15 +20,13 @@ class ListCAF(ListView):
class ListApplicableSystem(ListView):
model = ApplicableSystem
-
- # TODO - add primary_nis_contact tick to the context
- # Context can be easily found with:
- # org.person_set.filter(primary_nis_contact=True) or similar
- # probably need a custom manager for this - to add in the POC
+ # apparently you can pass a list of model objects to a template if you name it
+ # here - otherwise you need to provide a QuerySet
+ template_name = "caf/applicablesystem_list.html"
def get_queryset(self):
-# ess = ApplicableSystem.objects.all().order_by("organisation__name")
- ess = ApplicableSystem.objects.with_primary_contact()
+ # TODO sort this list using basic Python sorted()
+ ess = ApplicableSystem.objects.with_primary_contact() # returns a list, not a QuerySet
return ess
def get_context_data(self, **kwargs):