views:

13

answers:

1

Hi. In my application I need to show in template stocks for my products. So from product view I'm returning variable {{stock}} which is my amount and then I'm trying to use it in template :

<div class="bar_in" width="{% widthratio {{stock}} 10 100 %}px" style="background:black;"></div>

But it constantly give me "Could not parse the remainder: '{{stock}}' from '{{stock}}' " error. I've tried casting it as int but still the same problem. How to make it work properly ?

+2  A: 

{{ ... }} is only needed if you want to output the context variable to the template. For tags that can use variables only the name is needed.

{% widthratio stock 10 100 %}
Ignacio Vazquez-Abrams
perfect, thanks !
owca