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(), 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") .order_by("shift__start_at")
.first() .first()
) )

View File

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