how to display the sql querie in the template when the sql querie contain the agregates and the annotate

i have the sql query like this and i want to display in my template then there is no error but my template is empty

def detail_labo(request,pk):
	context={'patient':patient, 'actelabo':actelabo}
	return render(request,'pages_t/detail_labo.html',context)
{% for labo in actelabo %}
                {% endfor %}

Have you verified that there is data in the resultset for the query?

What does the line print(actelabo) generate?

What do the Patient and other model (the model referred to by the actelabo reference variable) look like?

What does the rest of the template look like? Are there any conditions or blocks or other template elements that might be affecting this?

yes it does contain data and it looks like this

<QuerySet [
{'date_examen':, 12, 14), 'nom_patient': 4, 'somme_labo__sum': 560.0}, {'date_examen':, 12, 20), 'nom_patient': 4, 'somme_labo__sum': 19600.0}

So the keys in the dict are:

  • date_examen
  • nom_patient
  • somme_labo__sum

That’s the data you’re passing to the template.

But your template isn’t rendering any fields by that name. The fields you’re trying to render don’t appear in the context.

thank you very much for your message and for your help