diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index cf3c7a4..aa23702 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -20,6 +20,8 @@ class Shift(models.Model): # todo: add helper amount override field def __str__(self): return f"{self.room.name}: {self.start_at}" + def has_ended(self): + return (self.start_at + self.duration) < timezone.now() class Helper(models.Model): diff --git a/shiftregister/app/templates/shift.html b/shiftregister/app/templates/shift.html index d32f73b..42cf79d 100644 --- a/shiftregister/app/templates/shift.html +++ b/shiftregister/app/templates/shift.html @@ -2,6 +2,7 @@ {% block title %}Schichtansicht{% endblock %} {% block content %} +
{% if is_registered %}
Du bist zu dieser Schicht angemeldet
{% endif %} @@ -22,8 +23,9 @@ Dauer: {{ shift.duration }}
{{ shift_form.as_p }} -{% else %} +{% elif not shift.has_ended %} Bitte wende dich an den Infopoint, falls du es nicht zu deiner Schicht schaffst. {% endif %} {% endif %} +
{% endblock %}