avancé dev

This commit is contained in:
Ambulance Clerc
2022-03-01 07:09:12 +01:00
parent c990f87413
commit efdf44864f
11 changed files with 82 additions and 115 deletions

View File

@@ -1,3 +1,34 @@
from django.db.models import Sum
from django.shortcuts import render
from django.shortcuts import get_object_or_404, render
from django.http import Http404
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse
from django.views import generic
from collabs.models import *
# Create your views here.
class ExportView(generic.ListView):
model = Collabs_hour
template_name = 'collabs_hour/detail.html'
context_object_name = 'latest_hour_list'
def get_queryset(self):
collabs = Collabs_hour.objects.filter(dtCreated__year=self.kwargs.get("year"), dtCreated__month= self.kwargs.get("month"))
ret = []
last_user = 0
for collab in collabs:
print(f"last_id = {last_user} id={collab.user}")
if last_user != collab.user:
last_user = collab.user
#collab.total = collab.get_total_hour_by_user(self.kwargs.get("year"), self.kwargs.get("month"))
ret.append(collab)
return ret