From eab406baf819069d03ebbff50c707ca48745f038 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 15 May 2024 00:16:34 +0200 Subject: [PATCH] refactor(room_view): order shifts in database query --- shiftregister/team/templates/room_registrations.html | 10 ++++++---- shiftregister/team/views.py | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/shiftregister/team/templates/room_registrations.html b/shiftregister/team/templates/room_registrations.html index dfa7303..9d796f4 100644 --- a/shiftregister/team/templates/room_registrations.html +++ b/shiftregister/team/templates/room_registrations.html @@ -1,18 +1,20 @@ {% extends "base.html" %} +{% block title %}{{ room.name }}{% endblock %} + {% block everything %}
-

Helfer:innen für {{ room.name }}

+

Helfer*innen für {{ room.name }}

- + -{% for shift in room.valid_shifts.all|dictsort:"start_at" %} +{% for shift in shifts %} @@ -22,4 +24,4 @@
StartzeitHelfer:innenHelfer*innen
{{ shift.start_at }} {% for reg in shift.valid_registrations.all %}{{ reg.helper.name }}{% if not forloop.last %}, {% endif %}{% endfor %}
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/shiftregister/team/views.py b/shiftregister/team/views.py index 8ba11ed..b611dbe 100644 --- a/shiftregister/team/views.py +++ b/shiftregister/team/views.py @@ -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")}, )