diff options
Diffstat (limited to '')
-rw-r--r-- | ctrack/caf/models.py | 10 |
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 |