Aggregate in Django


# response_work_projects = []


# for report in report_statics:

# workperteammates = report.workperteammate_set.filter(mate__id=user_id)

# total_hours_worked = workperteammates.aggregate(sum_hours_worked=Sum('hours_worked'))['sum_hours_worked']

# report_data = {

# 'title': report.title,

# 'hour': total_hours_worked

# }

# response_work_projects.append(report_data)


date:Aug. 21, 2023