feat: group org list by hq country

Resolves #86
This commit is contained in:
James Graham
2021-03-08 11:45:43 +00:00
parent 12bc9f886f
commit d1dc505b37

View File

@@ -15,39 +15,36 @@
href="{% url 'people:organisation.create' %}">New Organisation</a> href="{% url 'people:organisation.create' %}">New Organisation</a>
<table class="table table-borderless"> <table class="table table-borderless">
<thead> {% regroup organisation_list.all by current_answers.hq_country as countries %}
<tr>
<th>Name</th>
</tr>
</thead>
<tbody> <tbody>
{% for organisation in organisation_list.all %} {% for country in countries %}
<tr> <tr><th>{{ country.grouper.name|default:"Unknown" }}</th></tr>
<td>{{ organisation }}</td>
<td>
<a class="btn btn-sm btn-info"
href="{% url 'people:organisation.detail' pk=organisation.pk %}">Details</a>
{% if organisation.pk in existing_relationships %} {% for organisation in country.list %}
<a class="btn btn-sm btn-warning" <tr>
style="width: 10rem" <td>{{ organisation }}</td>
href="{% url 'people:organisation.relationship.create' organisation_pk=organisation.pk %}">Update Relationship {% comment %}
</a> <td>
<a class="btn btn-sm btn-info"
href="{% url 'people:organisation.detail' pk=organisation.pk %}">Details</a>
{% else %} {% if organisation.pk in existing_relationships %}
<a class="btn btn-sm btn-success" <a class="btn btn-sm btn-warning"
style="width: 10rem" style="width: 10rem"
href="{% url 'people:organisation.relationship.create' organisation_pk=organisation.pk %}">New Relationship href="{% url 'people:organisation.relationship.create' organisation_pk=organisation.pk %}">Update Relationship
</a> </a>
{% endif %}
</td>
</tr>
{% empty %} {% else %}
<tr> <a class="btn btn-sm btn-success"
<td>No records</td> style="width: 10rem"
</tr> href="{% url 'people:organisation.relationship.create' organisation_pk=organisation.pk %}">New Relationship
</a>
{% endif %}
</td>
{% endcomment %}
</tr>
{% endfor %}
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>