From 9fcba92a71d1aaf09617f7835ce326df57676d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=2EGeisler=20=26=20B=2E=20H=C3=A4ttasch?= <ak@kif.rocks> Date: Wed, 8 Jan 2020 21:30:52 +0100 Subject: [PATCH] add end time property to AK slot model --- AKModel/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AKModel/models.py b/AKModel/models.py index 45319e30..c6c2ffef 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -1,4 +1,5 @@ # Create your models here. +import datetime import itertools from django.db import models @@ -284,3 +285,10 @@ class AKSlot(models.Model): if self.start is None: return _("Not scheduled yet") return self.start.strftime('%a %H:%M') + + @property + def end(self): + """ + Retrieve end time of the AK slot + """ + return self.start + datetime.timedelta(hours=float(self.duration)) -- GitLab