mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
fix: error when viewing profile with no answerset
This commit is contained in:
@@ -62,6 +62,12 @@
|
|||||||
<td>{{ answers }}</td>
|
<td>{{ answers }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if answer_set is None %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">No answers</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,12 @@
|
|||||||
<td>{{ answers }}</td>
|
<td>{{ answers }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if answer_set is None %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">No answers</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,12 @@
|
|||||||
<td>{{ answers }}</td>
|
<td>{{ answers }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if answer_set is None %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">No answers</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -114,9 +114,14 @@ class OrganisationDetailView(LoginRequiredMixin, DetailView):
|
|||||||
questions = questions.filter(answer_is_public=True)
|
questions = questions.filter(answer_is_public=True)
|
||||||
|
|
||||||
question_answers = {}
|
question_answers = {}
|
||||||
for question in questions:
|
try:
|
||||||
answers = answer_set.question_answers.filter(question=question)
|
for question in questions:
|
||||||
question_answers[str(question)] = ', '.join(map(str, answers))
|
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
|
return question_answers
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,14 @@ class ProfileView(LoginRequiredMixin, DetailView):
|
|||||||
questions = questions.filter(answer_is_public=True)
|
questions = questions.filter(answer_is_public=True)
|
||||||
|
|
||||||
question_answers = {}
|
question_answers = {}
|
||||||
for question in questions:
|
try:
|
||||||
answers = answer_set.question_answers.filter(question=question)
|
for question in questions:
|
||||||
question_answers[str(question)] = ', '.join(map(str, answers))
|
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
|
return question_answers
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user