allow team to remove helpers from shifts

pull/1/head
parent 05d633b826
commit 9aeee34e7c

@ -17,13 +17,16 @@
{% for reg in shift.shiftregistration_set.all %} {% for reg in shift.shiftregistration_set.all %}
<div class="column is-one-quarter"> <div class="column is-one-quarter">
<div class="box is-flex is-align-items-center is-justify-content-space-between"> <div class="box is-flex is-align-items-center is-justify-content-space-between">
<a class="is-block is-size-4" href="{% url 'team:helper' reg.helper.pk %}">{{ reg.helper.name }}</a> <div class="content">
<a class="is-size-4" href="{% url 'team:helper' reg.helper.pk %}">{{ reg.helper.name }}</a>
<a class="button is-link is-small" href="tel:{{ reg.helper.phone }}">📞</a> <a class="button is-link is-small" href="tel:{{ reg.helper.phone }}">📞</a>
{% if not reg.is_checked_in %} {% if not reg.is_checked_in %}
<a class="button is-warning is-small" href="{%url 'team:checkin' reg.pk%}">als angekommen markieren</a> <a class="button is-warning is-small" href="{%url 'team:checkin' reg.pk%}">als angekommen markieren</a><br>
{% else %} {% else %}
<div class="button is-success"></div> <div class="button is-success"></div>
{% endif %} {% endif %}
<a class="button is-danger is-small" href="{%url 'team:unregister' reg.pk%}">helfer abmelden</a>
</div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}

@ -12,4 +12,5 @@ urlpatterns = [
path("helper/<int:pk>", views.HelperDetail.as_view(), name="helper"), path("helper/<int:pk>", views.HelperDetail.as_view(), name="helper"),
path("message/", views.bulk_message, name="bulk_message"), path("message/", views.bulk_message, name="bulk_message"),
path("checkin/<int:pk>", views.checkin, name="checkin"), path("checkin/<int:pk>", views.checkin, name="checkin"),
path("remove_helper/<int:pk>", views.delete_shiftregistration, name="unregister"),
] ]

@ -162,3 +162,10 @@ def checkin(request, pk):
reg.state = reg.RegState.CHECKED_IN reg.state = reg.RegState.CHECKED_IN
reg.save() reg.save()
return redirect("team:shift", pk=reg.shift.pk) 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)

Loading…
Cancel
Save