refactor(room_view): order shifts in database query
This commit is contained in:
parent
063313f87b
commit
eab406baf8
|
@ -1,18 +1,20 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ room.name }}{% endblock %}
|
||||
|
||||
{% block everything %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h3 class="title" style="background:var(--background);margin:0 -1rem;padding:1rem;position:sticky;top:0;">Helfer:innen für {{ room.name }}</h3>
|
||||
<h3 class="title" style="background:var(--background);margin:0 -1rem;padding:1rem;position:sticky;top:0;">Helfer*innen für {{ room.name }}</h3>
|
||||
<table class="table">
|
||||
<thead style="background:inherit;position:sticky;top:4rem;">
|
||||
<tr>
|
||||
<th>Startzeit</th>
|
||||
<th>Helfer:innen</th>
|
||||
<th>Helfer*innen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for shift in room.valid_shifts.all|dictsort:"start_at" %}
|
||||
{% for shift in shifts %}
|
||||
<tr>
|
||||
<td>{{ shift.start_at }}</td>
|
||||
<td>{% for reg in shift.valid_registrations.all %}{{ reg.helper.name }}{% if not forloop.last %}, {% endif %}{% endfor %}</td>
|
||||
|
|
|
@ -401,10 +401,11 @@ def mark_as_read(request, pk):
|
|||
|
||||
|
||||
def room_view_token(request, token):
|
||||
token = get_object_or_404(RoomViewToken, pk=token)
|
||||
room = token.room
|
||||
|
||||
return render(
|
||||
request,
|
||||
"room_registrations.html",
|
||||
{
|
||||
"room": get_object_or_404(RoomViewToken, pk=token).room,
|
||||
},
|
||||
{"room": room, "shifts": room.valid_shifts().order_by("start_at")},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue