From c6dd5b5eca2f3583132cbdc2465e396dd36d0635 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 27 Apr 2022 20:24:00 +0200 Subject: [PATCH] Hide buttons if shift is deleted --- shiftregister/app/models.py | 2 +- shiftregister/app/templates/shift.html | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index a652d27..68435de 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -58,7 +58,7 @@ class Helper(models.Model): output_field=models.DateTimeField(), ) ) - .filter(helper=self, shift_end__gte=timezone.now()) + .filter(helper=self, shift_end__gte=timezone.now(), shift__deleted=False) .order_by("shift__start_at") .first() ) diff --git a/shiftregister/app/templates/shift.html b/shiftregister/app/templates/shift.html index dc5fba9..596e799 100644 --- a/shiftregister/app/templates/shift.html +++ b/shiftregister/app/templates/shift.html @@ -9,20 +9,23 @@ {% endif %} {% if shift.deleted %}
Diese Schicht wurde gelöscht.
+{% endif %} +{% if not can_register and not is_registered %} +
Diese Schicht ist bereits besetzt.
{% endif %}
Ort: {{ shift.room.name }}
Beginn: {{ shift.start_at }}
Dauer: {{ shift.duration }}
-{% if can_register %} +{% if can_register and not shift.deleted %}
{% csrf_token %} {{ shift_form.as_p }}
{% endif %} -{% if is_registered %} +{% if is_registered and not shift.deleted %} {% if can_cancel %}
{% csrf_token %}