aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf/models.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-09-10 16:48:01 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-09-10 16:48:01 +0100
commita336fc622aee1676470b316b8559de295de54094 (patch)
tree46fcb3be8c61600b7c7c1ee4ae5db2dfa0d62e0d /ctrack/caf/models.py
parent0ac9dd52b75a19e17098daa1c06a46fc7fa113e7 (diff)
moving forward with systems in scope list page
Diffstat (limited to 'ctrack/caf/models.py')
-rw-r--r--ctrack/caf/models.py10
1 files changed, 8 insertions, 2 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