2
0
Fork 0

Hide buttons if shift is deleted

This commit is contained in:
Luca 2022-04-27 20:24:00 +02:00
parent 61b28da346
commit c6dd5b5eca
2 changed files with 6 additions and 3 deletions

View File

@ -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()
)

View File

@ -9,20 +9,23 @@
{% endif %}
{% if shift.deleted %}
<div class="notification">Diese Schicht wurde gelöscht.</div>
{% endif %}
{% if not can_register and not is_registered %}
<div class="notification">Diese Schicht ist bereits besetzt.</div>
{% endif %}
<div class="content">
<strong>Ort:</strong> {{ shift.room.name }}<br>
<strong>Beginn:</strong> {{ shift.start_at }}<br>
<strong>Dauer:</strong> {{ shift.duration }}
</div>
{% if can_register %}
{% if can_register and not shift.deleted %}
<form action="" method="post">
{% csrf_token %}
{{ shift_form.as_p }}
<input type="submit" class="button is-link" value="Anmelden">
</form>
{% endif %}
{% if is_registered %}
{% if is_registered and not shift.deleted %}
{% if can_cancel %}
<form action="{% url 'cancel' shift.pk %}" method="post">
{% csrf_token %}