refactor: move questions on person detail page

This commit is contained in:
James Graham
2020-12-02 14:57:07 +00:00
parent 91a47b4fdc
commit 0288b0320d

View File

@@ -22,81 +22,81 @@
</div> </div>
{% endif %} {% endif %}
<dl>
{% if person.nationality %}
<dt>Nationality</dt>
<dd>{{ person.nationality.name }}</dd>
{% endif %}
{% if person.country_of_residence %} {% with person.current_answers as answer_set %}
<dt>Country of Residence</dt> <dl>
<dd>{{ person.country_of_residence.name }}</dd> </dl>
{% endif %}
{% if person.organisation %} <table class="table table-borderless">
<dt>Organisation</dt> <thead>
<dd>{{ person.organisation }}</dd> <tr>
<th>Question</th>
<th>Answer</th>
</tr>
</thead>
{% if person.organisation_started_date %} <tbody>
<dt>Started Date</dt> {% if answer_set.nationality %}
<dd>{{ person.organisation_started_date }}</dd> <tr><td>Nationality</td><td>{{ answer_set.nationality.name }}</td>
{% endif %} {% endif %}
{% endif %}
{% if person.job_title %} {% if answer_set.country_of_residence %}
<dt>Job Title</dt> <tr><td>Country of Residence</td><td>{{ answer_set.country_of_residence.name }}</td></tr>
<dd>{{ person.job_title }}</dd> {% endif %}
{% endif %}
{% if person.disciplines %} {% if answer_set.organisation %}
<dt>Discipline(s)</dt> <tr><td>Organisation</td><td>{{ answer_set.organisation }}</td></tr>
<dd>{{ person.disciplines }}</dd> {% endif %}
{% endif %}
{% if person.themes.exists %} {% if answer_set.organisation_started_date %}
<dt>Project Themes</dt> <tr><td>Organisation Started Date</td><td>{{ answer_set.organisation_started_date }}</td></tr>
<dd> {% endif %}
{% for theme in person.themes.all %}
{{ theme }}{% if not forloop.last %}, {% endif %} {% if answer_set.job_title %}
{% endfor %} <tr><td>Job Title</td><td>{{ answer_set.job_title }}</td></tr>
</dd> {% endif %}
{% endif %}
</dl> {% if answer_set.disciplines %}
<tr><td>Discipline(s)</td><td>{{ answer_set.disciplines }}</td></tr>
{% endif %}
{% if answer_set.themes.exists %}
<tr>
<td>Project Themes</td>
<td>
{% for theme in answer_set.themes.all %}
{{ theme }}{% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
</tr>
{% endif %}
{% for answer in answer_set.question_answers.all %}
<tr>
<td>{{ answer.question }}</td>
<td>{{ answer }}</td>
</tr>
{% empty %}
<tr>
<td>No records</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>Last updated: {{ answer_set.timestamp }}</p>
{% endwith %}
<a class="btn btn-success"
href="{% url 'people:person.update' pk=person.pk %}">Update</a>
{% if person.user == request.user %}
<a class="btn btn-info"
href="{% url 'password_change' %}?next={{ person.get_absolute_url }}">Change Password</a>
{% endif %}
{% endif %} {% endif %}
{% with person.current_answers as answer_set %}
<table class="table table-borderless">
<thead>
<tr>
<th>Question</th>
<th>Answer</th>
</tr>
</thead>
<tbody>
{% for answer in answer_set.question_answers.all %}
<tr>
<td>{{ answer.question }}</td>
<td>{{ answer }}</td>
</tr>
{% empty %}
<tr>
<td>No records</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>Last updated: {{ answer_set.timestamp }}</p>
{% endwith %}
<a class="btn btn-success"
href="{% url 'people:person.update' pk=person.pk %}">Update</a>
<a class="btn btn-info"
href="{% url 'password_change' %}?next={{ person.get_absolute_url }}">Change Password</a>
<hr> <hr>
<div class="row"> <div class="row">