diff --git a/people/templates/people/organisation/detail.html b/people/templates/people/organisation/detail.html index 00cb7c6..640be30 100644 --- a/people/templates/people/organisation/detail.html +++ b/people/templates/people/organisation/detail.html @@ -62,6 +62,12 @@ {{ answers }} {% endfor %} + + {% if answer_set is None %} + + No answers + + {% endif %} diff --git a/people/templates/people/person/includes/answer_set_full.html b/people/templates/people/person/includes/answer_set_full.html index c69055f..ca3343d 100644 --- a/people/templates/people/person/includes/answer_set_full.html +++ b/people/templates/people/person/includes/answer_set_full.html @@ -37,6 +37,12 @@ {{ answers }} {% endfor %} + + {% if answer_set is None %} + + No answers + + {% endif %} diff --git a/people/templates/people/person/includes/answer_set_partial.html b/people/templates/people/person/includes/answer_set_partial.html index 3e1fe71..954ec0a 100644 --- a/people/templates/people/person/includes/answer_set_partial.html +++ b/people/templates/people/person/includes/answer_set_partial.html @@ -21,6 +21,12 @@ {{ answers }} {% endfor %} + + {% if answer_set is None %} + + No answers + + {% endif %} diff --git a/people/views/organisation.py b/people/views/organisation.py index bc77f88..c22f3d2 100644 --- a/people/views/organisation.py +++ b/people/views/organisation.py @@ -114,9 +114,14 @@ class OrganisationDetailView(LoginRequiredMixin, DetailView): questions = questions.filter(answer_is_public=True) question_answers = {} - for question in questions: - answers = answer_set.question_answers.filter(question=question) - question_answers[str(question)] = ', '.join(map(str, answers)) + try: + for question in questions: + answers = answer_set.question_answers.filter(question=question) + question_answers[str(question)] = ', '.join(map(str, answers)) + + except AttributeError: + # No AnswerSet yet + pass return question_answers diff --git a/people/views/person.py b/people/views/person.py index 14634eb..5654a19 100644 --- a/people/views/person.py +++ b/people/views/person.py @@ -79,9 +79,14 @@ class ProfileView(LoginRequiredMixin, DetailView): questions = questions.filter(answer_is_public=True) question_answers = {} - for question in questions: - answers = answer_set.question_answers.filter(question=question) - question_answers[str(question)] = ', '.join(map(str, answers)) + try: + for question in questions: + answers = answer_set.question_answers.filter(question=question) + question_answers[str(question)] = ', '.join(map(str, answers)) + + except AttributeError: + # No AnswerSet yet + pass return question_answers