Hide buttons if shift is deleted

pull/1/head
Luca 3 years ago
parent 61b28da346
commit c6dd5b5eca

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

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

Loading…
Cancel
Save