Hi everyone. I’m new using Django. I have a very important project I have to develop for my chief. How Can I call severals methods in the same template using the same url. Is that possible?

You’re looking at this from the wrong angle.

Your URL is mapped to, and calls, a View. This view does whatever processing needs to be performed, building what Django refers to as the context. This context is passed to whatever function is used to render a template to produce the HTTP response.

If you’re not clear on the flow of events, I suggest you work all the way through the standard Django tutorial to get a better feel for how all the pieces fit together.


1 Like

Thank you Mr Ken
Is very kind.
I have an idea of ​​how it works, but I try to display some datas from my database in the template base and I can just do it one at a time.

I can’t display all the datas I want at the same time. My project charge several images, which represent categories, suppliers, etc. Each one of my methods makes a query to the database but I cannot merge everything at the same time and showing it in the template.

How could I do? I have these two fonctions and I want they work as one, so I can use it in my base template
def fournisseur(request):
cont = Fournisseur.objects.all()
return render(request, “blog/prueba.html”, {‘fournisseur’: cont})
def testing(request):
context = Service.objects.all()
return render(request, “blog/prueba1.html”, {‘context’: context})

Best regards,

Thanks a lot.
I already found a solution.