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 %}