mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
fix: error when viewing profile with no answerset
This commit is contained in:
@@ -62,6 +62,12 @@
|
||||
<td>{{ answers }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
{% if answer_set is None %}
|
||||
<tr>
|
||||
<td colspan="2">No answers</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -37,6 +37,12 @@
|
||||
<td>{{ answers }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
{% if answer_set is None %}
|
||||
<tr>
|
||||
<td colspan="2">No answers</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
<td>{{ answers }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
{% if answer_set is None %}
|
||||
<tr>
|
||||
<td colspan="2">No answers</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -114,10 +114,15 @@ class OrganisationDetailView(LoginRequiredMixin, DetailView):
|
||||
questions = questions.filter(answer_is_public=True)
|
||||
|
||||
question_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
|
||||
|
||||
def get_context_data(self,
|
||||
|
||||
@@ -79,10 +79,15 @@ class ProfileView(LoginRequiredMixin, DetailView):
|
||||
questions = questions.filter(answer_is_public=True)
|
||||
|
||||
question_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
|
||||
|
||||
def get_context_data(self,
|
||||
|
||||
Reference in New Issue
Block a user