1

I have the following view in my views.py:

timesheet = Timesheet.objects.annotate(
    total_time=ExpressionWrapper(
        ExpressionWrapper(F('out') - F('entry'), output_field=IntegerField()) -
        Coalesce(ExpressionWrapper(F('lunch_end') - F('lunch'), output_field=IntegerField()), Value(0)),
       output_field=DurationField()
    )
)

This allows me to calculate the total worked hours in a single day, which is then looped on a table.

But, I need to be able to Sum all the total worked hours from each specific month.

Is this achievable?

overclock
  • 585
  • 3
  • 20

0 Answers0