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