I have a model called Precompra
and from there I am interested in the price to calculate the total for now.
What is the problem with this code that is not showing me the result in the template.
This code was programmed in view.py
:
def precio_pactado(request):
aux = 0
precompra=list(Precompra.objects.all())
for compras in precompra:
aux = compras.precio + compras.precio
return render(request, 'carrito.html', locals())
Any ideas?