Comment ajouter les données dans Django QuerySet
def getDatat():
qs = CustomerInformation.objects.filter(salesDepartment__in=[d]).filter(created_date__range=(start,end))
qs = qs.annotate(date=TruncMonth('created_date')).values('date').annotate(lead_count=Count('status',filter=Q(status="lead"))).annotate(client_count=Count('status',filter=Q(status="client")))
qs = qs.values('date', 'client_count', 'lead_count')
this_v = None
for next_v in qs:
if this_v is None:
this_v = next_v
yield this_v
continue
# Do logic for checking if there's any needed extra values between this_v and next_V
# yield extra values
this_v = next_v
yield this_v
Mad developer