mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
fix: account for org with no answers when get name
This commit is contained in:
@@ -43,7 +43,13 @@ class Organisation(models.Model):
|
|||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
# Prefer name as in latest OrganisationAnswerSet
|
# Prefer name as in latest OrganisationAnswerSet
|
||||||
return self.current_answers.name or self.name
|
try:
|
||||||
|
name = self.current_answers.name
|
||||||
|
|
||||||
|
except AttributeError:
|
||||||
|
name = ''
|
||||||
|
|
||||||
|
return name or self.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_answers(self) -> 'OrganisationAnswerSet':
|
def current_answers(self) -> 'OrganisationAnswerSet':
|
||||||
|
|||||||
Reference in New Issue
Block a user