mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
fix: attribute error on org list page
Error for organisations with no AnswerSet
This commit is contained in:
@@ -71,6 +71,7 @@ class OrganisationListView(LoginRequiredMixin, ListView):
|
|||||||
answers = organisation.current_answers
|
answers = organisation.current_answers
|
||||||
|
|
||||||
country = 'Unknown'
|
country = 'Unknown'
|
||||||
|
try:
|
||||||
if len(answers.countries) == 1:
|
if len(answers.countries) == 1:
|
||||||
country = answers.countries[0].name
|
country = answers.countries[0].name
|
||||||
|
|
||||||
@@ -80,6 +81,9 @@ class OrganisationListView(LoginRequiredMixin, ListView):
|
|||||||
if answers.is_partner_organisation:
|
if answers.is_partner_organisation:
|
||||||
country = f'{settings.PARENT_PROJECT_NAME} partners'
|
country = f'{settings.PARENT_PROJECT_NAME} partners'
|
||||||
|
|
||||||
|
except AttributeError:
|
||||||
|
# Organisation has no AnswerSet - country is 'Unknown'
|
||||||
|
|
||||||
orgs = orgs_by_country.get(country, [])
|
orgs = orgs_by_country.get(country, [])
|
||||||
orgs.append(organisation)
|
orgs.append(organisation)
|
||||||
orgs_by_country[country] = orgs
|
orgs_by_country[country] = orgs
|
||||||
|
|||||||
Reference in New Issue
Block a user