【发布时间】:2020-02-24 18:31:43
【问题描述】:
我正在使用 Django 2.0 和 Python 3.7。我读过我可以通过使用 widthratio - multiplication in django template without using manually created template tag 在模板中进行乘法运算。但是,在我的模板中,我尝试这样做无济于事。我在努力
{% if widthratio articlestat.score 1 TRENDING_PCT_FLOOR >= articlestat.weighted_score %}style="font-weight:bold;"{% endif %}
当我的模板使用此代码执行时,它给出了错误...
Unused 'articlestat.score' at end of if expression.
我希望我的 if 表达式说明“articlestat.score”和“TRENDING_PCT_FLOOR”的倍数是否大于“articlestat.weighted_score”,将其打印出来,但我似乎不知道该怎么做。
【问题讨论】:
标签: django python-3.x templates multiplication