How to get current month values from Django Model, convert to int() and sum?

I decided to implement a display of the time spent on work. To do this, you need to add some code to

current_month =
minutes = Addinfo.objects.filter(date_added__month=current_month).values_list('work_minutes', flat=True)
summa = sum([int(minute) for minute in minutes])
hours = (summa // 60)

Don’t forget add new variables to context dict.

See also  How to add a click on a row in a table and keep the links active
Author: admin

Leave a Reply

Your email address will not be published. Required fields are marked *