From 12bc9f886fed4fcb825b0ed6571f3a2a82df5119 Mon Sep 17 00:00:00 2001 From: James Graham Date: Fri, 5 Mar 2021 12:21:39 +0000 Subject: [PATCH] fix: use organisation name from answer set if set Resolves #90 --- people/models/organisation.py | 3 ++- people/templates/people/organisation/detail.html | 2 +- people/templates/people/organisation/update.html | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/people/models/organisation.py b/people/models/organisation.py index 7200ca6..7b7094c 100644 --- a/people/models/organisation.py +++ b/people/models/organisation.py @@ -42,7 +42,8 @@ class Organisation(models.Model): name = models.CharField(max_length=255, blank=False, null=False) def __str__(self) -> str: - return self.name + # Prefer name as in latest OrganisationAnswerSet + return self.current_answers.name or self.name @property def current_answers(self) -> 'OrganisationAnswerSet': diff --git a/people/templates/people/organisation/detail.html b/people/templates/people/organisation/detail.html index 66d0198..5833c4a 100644 --- a/people/templates/people/organisation/detail.html +++ b/people/templates/people/organisation/detail.html @@ -20,7 +20,7 @@ -

{{ organisation.name }}

+

{{ organisation }}


diff --git a/people/templates/people/organisation/update.html b/people/templates/people/organisation/update.html index 7b5aa44..2e19383 100644 --- a/people/templates/people/organisation/update.html +++ b/people/templates/people/organisation/update.html @@ -24,7 +24,7 @@ -

{{ organisation.name }}

+

{{ organisation }}