The JS snippet I created relies on the forloop.counter variable being available within a {% for key, value in data.items %}..{% endfor %}
tag.
Is there
I make the next in my template file carts.html
{% extends 'base.html'%} {% block contenido %}
Checkout
Subtotal + IVA: ${{ orden.sub_total }}
Envio:$ {{ orden.costo_envio }}
Total a pagar:$ {{ orden.sub_total|add:orden.costo_envio }}
{% endblock %}
where my view based function is:
def carrito_checkout(request):
if 'cart_id' in request.session:
orden_object, created = Orden.objects.get_or_new(request)
if orden_object is None:
return redirect('carrito:home')
print(orden_object)
context = {
"orden": orden_object
}
return render(request, 'carrito_checkout.html', context=context)
For me this aproach works fine