开发者

Using widthratio tag properly

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开发者_StackOverflow社区 make it work properly ?


{{ ... }} 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 %}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜