Arbeitstage Historymodell dazu

This commit is contained in:
holger.trampe 2021-01-07 17:12:06 +01:00
parent 080b328165
commit 2851cc8807
6 changed files with 24 additions and 2 deletions

BIN
dump.rdb

Binary file not shown.

View File

@ -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
'''

View File

@ -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)
@ -21,6 +24,7 @@ class Breaks(models.Model):
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)
name = models.CharField(default="", max_length=200)

View File

@ -23,6 +23,7 @@
<th scope="col">Pausen</th>
<th scope="col">Gesamtzeit</th>
<th scope="col">Gleitzeit</th>
<th scope="col">Manuell geändert</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
@ -297,6 +298,18 @@
{% endfor %}
</td>
<td>
{% for workday in workdays %}
{% if workday.end|date:"d-m-y" == da|date:"d-m-y" %}
{% getWorkDayHistory workday as wd_history %}
{% if wd_history.history_user != None %}
{{wd_history.history_date|date:"d.m.Y, H:i"}} von {{wd_history.history_user.first_name}} {{wd_history.history_user.last_name}}
{% endif %}
{% endif %}
{% endfor %}
</td>
<td>
{% counterWDreset %}
@ -319,7 +332,7 @@
{% endfor %}
</td>
{% else %}
<td></td><td></td><td></td><td></td><td style="display: none;"></td><td style="display: none;"></td>
<td></td><td></td><td></td><td></td><td></td><td style="display: none;"></td><td style="display: none;"></td>
{% endif %}
</tr>
{% endfor %}