开发者

Using widthratio tag properly

开发者 https://www.devze.com 2022-12-26 02:08 出处:网络
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 :

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

精彩评论

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