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