From 9aeee34e7c895c1aae6ccf5a2dc23424e9addef1 Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Sat, 21 May 2022 10:48:24 +0200 Subject: [PATCH] allow team to remove helpers from shifts --- shiftregister/team/templates/shift_detail.html | 7 +++++-- shiftregister/team/urls.py | 1 + shiftregister/team/views.py | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/shiftregister/team/templates/shift_detail.html b/shiftregister/team/templates/shift_detail.html index 2118f68..9ffd4c6 100644 --- a/shiftregister/team/templates/shift_detail.html +++ b/shiftregister/team/templates/shift_detail.html @@ -17,13 +17,16 @@ {% for reg in shift.shiftregistration_set.all %}
- {{ reg.helper.name }} +
+ {{ reg.helper.name }} 📞 {% if not reg.is_checked_in %} - als angekommen markieren + als angekommen markieren
{% else %}
✓
{% endif %} + helfer abmelden +
{% endfor %} diff --git a/shiftregister/team/urls.py b/shiftregister/team/urls.py index a71118e..8f56b70 100644 --- a/shiftregister/team/urls.py +++ b/shiftregister/team/urls.py @@ -12,4 +12,5 @@ urlpatterns = [ path("helper/", views.HelperDetail.as_view(), name="helper"), path("message/", views.bulk_message, name="bulk_message"), path("checkin/", views.checkin, name="checkin"), + path("remove_helper/", views.delete_shiftregistration, name="unregister"), ] diff --git a/shiftregister/team/views.py b/shiftregister/team/views.py index 2b26a13..8c0dbec 100644 --- a/shiftregister/team/views.py +++ b/shiftregister/team/views.py @@ -162,3 +162,10 @@ def checkin(request, pk): reg.state = reg.RegState.CHECKED_IN reg.save() return redirect("team:shift", pk=reg.shift.pk) + +@login_required +def delete_shiftregistration(request, pk): + reg = get_object_or_404(ShiftRegistration, pk=pk) + spk = reg.shift.pk + reg.delete() + return redirect("team:shift", pk=spk)