diff --git a/dump.rdb b/dump.rdb index bf4df83..3670352 100644 Binary files a/dump.rdb and b/dump.rdb differ diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index 218e5f3..930949e 100644 Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index 8ac8e85..4dc9db4 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -69,6 +69,11 @@ def getbool(): def getmesscounter(user): return len(Message.objects.filter(target_user=user)) +# WORKDAY HISTORY +@register.simple_tag +def getWorkDayHistory(workday): + workday = Workday.objects.get(pk=workday.pk) + return workday.history.first() # usergperm ''' diff --git a/timemanagement/models.py b/timemanagement/models.py index a4b6021..5082d1f 100644 --- a/timemanagement/models.py +++ b/timemanagement/models.py @@ -5,6 +5,8 @@ from django.core.exceptions import ValidationError from colorful.fields import RGBColorField from django.utils import timezone +from simple_history.models import HistoricalRecords + # Create your models here. class Workday(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) @@ -13,6 +15,7 @@ class Workday(models.Model): start = models.DateTimeField(default=None, null=True, blank=True) end = models.DateTimeField(default=None, null=True, blank=True) target = models.FloatField(default=8.0) + history = HistoricalRecords() class Breaks(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) @@ -20,6 +23,7 @@ class Breaks(models.Model): workday = models.ForeignKey("Workday", on_delete=models.CASCADE, related_name='workdayele') start = models.DateTimeField(default=None, null=True, blank=True) end = models.DateTimeField(default=None, null=True, blank=True) + class AbsenceReason(models.Model): agency = models.ForeignKey(Agency, on_delete=models.CASCADE) diff --git a/timemanagement/templates/timemanagement/timemanagement_teamview_single.html b/timemanagement/templates/timemanagement/timemanagement_teamview_single.html index bc18e46..3e3215a 100644 --- a/timemanagement/templates/timemanagement/timemanagement_teamview_single.html +++ b/timemanagement/templates/timemanagement/timemanagement_teamview_single.html @@ -23,6 +23,7 @@