From 12d1c2c147eecfa326ee8d33cc6110f2797f810a Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Tue, 16 Jul 2019 13:10:49 +0200 Subject: [PATCH] Add model for period. --- biscuit/apps/chronos/models.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 biscuit/apps/chronos/models.py diff --git a/biscuit/apps/chronos/models.py b/biscuit/apps/chronos/models.py new file mode 100644 index 00000000..456f2669 --- /dev/null +++ b/biscuit/apps/chronos/models.py @@ -0,0 +1,24 @@ +from django.db import models +from django.utils.translation import ugettext_lazy as _ + + +class TimePeriod(models.Model): + WEEKDAY_CHOICES = [ + (0, _('Sunday')), + (1, _('Monday')), + (2, _('Tuesday')), + (3, _('Wednesday')), + (4, _('Thursday')), + (5, _('Friday')), + (6, _('Saturday')) + ] + + weekday = models.PositiveSmallIntegerField(verbose_name=_( + 'Week day'), choices=WEEKDAY_CHOICES) + period = models.PositiveSmallIntegerField( + verbose_name=_('Number of period')) + time_start = models.TimeField(verbose_name=_('Time the period starts')) + time_end = models.TimeField(verbose_name=_('Time the period ends')) + + def __str__(self): + return '%s, %d. period (%s - %s)' % (self.weekday, self.period, self.time_start, self.time_end) -- GitLab