diff options
-rw-r--r-- | ctrack/caf/models.py | 10 | ||||
-rw-r--r-- | ctrack/caf/templates/caf/applicablesystem_list.html | 78 | ||||
-rw-r--r-- | ctrack/caf/views.py | 2 |
3 files changed, 47 insertions, 43 deletions
diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py index 5fd586f..a7d0019 100644 --- a/ctrack/caf/models.py +++ b/ctrack/caf/models.py @@ -85,8 +85,14 @@ class ApplicableSystem(models.Model): class Meta: verbose_name = "NIS System" - def get_primary_contact(self): - return self.organisation.person_set.filter(primary_nis_contact=True) + def get_organisation(self): + ess = self.essentialservice_set.all() + org_set = [es.organisation for es in ess] + if len(org_set) > 1: + breakpoint() + raise ValueError("Seeking one organisation, got {}.".format(len(org_set))) + else: + return org_set[0] def __str__(self): return self.name diff --git a/ctrack/caf/templates/caf/applicablesystem_list.html b/ctrack/caf/templates/caf/applicablesystem_list.html index d5d1342..435449a 100644 --- a/ctrack/caf/templates/caf/applicablesystem_list.html +++ b/ctrack/caf/templates/caf/applicablesystem_list.html @@ -7,46 +7,44 @@ <div class="container"> - <div class="row"> - <div class="col-sm-12"> - <h3>Systems in Scope</h3> - - <table id="datatable" class="display compact cell-border" style="width:100%"> - <thead> - <tr> - <th>Organisation</th> - <th>System</th> - <th>CAF</th> - <th>Sub Mode</th> - <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 %} - <tr> - <td><a href="{% url "organisations:detail" slug=sys.organisation.slug %}">{{ sys.organisation.name }}</a></td> - <td><a href="{% url "caf:ass_detail" sys.pk %}">{{ sys.name }}</a></td> - <td><a href="{% url "caf:detail" pk=sys.caf.id %}">{{ sys.caf }}</a></td> - <td>{{ sys.organisation.submode.descriptor }}</td> - <td class="tabaligncenter">{{ sys.caf.confidence_grading.descriptor }}</td> - <td>{{ sys.caf.triage_review_date }}</td> - <td>{{ sys.caf.triage_review_inspector.name }}</td> - {% if sys.get_primary_contact %} - <td>{{ sys.get_primary_contact.first }}</td> - {% else %} - <td>NA</td> - {% endif %} - </tr> - {% endfor %} - </table> - - </div> - </div> + <div class="row"> + <div class="col-sm-12"> + <h3>Systems in Scope</h3> + + <table id="datatable" class="display compact cell-border" style="width:100%"> + <thead> + <tr> + <th>Organisation</th> + <th>System</th> + <th>CAFs</th> + <th>Sub Mode</th> + <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 %} + <tr> + <td><a href="{% url "organisations:detail" slug=sys.get_organisation.slug %}">{{ sys.get_organisation.name }}</a></td> + <td><a href="{% url "caf:ass_detail" sys.pk %}">{{ sys.name }}</a></td> + <td> + <ul> + {% for c in sys.caf_set.all %} + <li><a href="{% url "caf:detail" c.pk %}">{{ c }}</a></li> + {% endfor %} + </ul> + </td> + <td>hello</td> + <td>hello</td> + <td>hello</td> + <td>hello</td> + <td>hello</td> + </tr> + {% endfor %} + </table> + </div> + </div> </div> {% endblock content %} - - - diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py index 480e305..08ab736 100644 --- a/ctrack/caf/views.py +++ b/ctrack/caf/views.py @@ -50,7 +50,7 @@ class ListApplicableSystem(LoginRequiredMixin, PermissionRequiredMixin, ListView permission_required = "caf.view_caf" def get_queryset(self): - ess = ApplicableSystem.objects.all().order_by("organisation__name") + ess = ApplicableSystem.objects.all().order_by("name") return ess def get_context_data(self, **kwargs): |