2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-01-19 12:23:01 +00:00

new page listing people's ids

This commit is contained in:
2025-01-20 20:42:26 +00:00
parent 1fcb2c5203
commit 7769fa868e
2 changed files with 45 additions and 0 deletions

View File

@@ -48,6 +48,21 @@ def notablepersons(request):
request, "notablepersons.html", {"persons": persons, "pcols": pcols, "notablepersons": notablepersons}
)
def people_ids(request):
persons = Person.objects.all()
# From what I can tell, "persons" seems to be the table rows, while "pcols" is the table columns. - AC 16 Feb 09
pcols = []
ncols = 4
nc = int((len(persons) + ncols - 1) / ncols)
for i in range(ncols):
pcols.append(persons[i * nc : (i + 1) * nc])
return render(
request, "people_ids.html", {"persons": persons, "pcols": pcols}
)
def expedition(request, expeditionname):
"""Returns a rendered page for one expedition, specified by the year e.g. '2019'.

30
templates/people_ids.html Normal file
View File

@@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block title %}Person Index{% endblock %}
{% block content %}
<!-- people.html - this text visible because this template has been included -->
<h2>All expoers</h2>
<table class="searchable">
<tr>
{% for persons in pcols %}
<td>
<table>
<tr><th>Person</th><th>troggle ID</th></tr>
{% for person in persons %}
<tr>
<td style="padding: 3px">{{person.fullname|safe}}</td>
<td style="padding: 3px"><a href="{{ person.get_absolute_url }}">{{person|safe}}</a></td>
</tr>
{% endfor %}
</table>
</td>
{% endfor %}
</tr>
</table>
{% endblock %}