【发布时间】:2017-05-20 18:19:06
【问题描述】:
我无法弄清楚这一点,它快把我逼疯了!看起来很简单,但我一定错过了一些东西。我正在尝试将计数(整数)与 0 进行比较,如果计数的值为 0,则使用 noty 打印一条消息。这是我的代码:
var count = 0;
{% for inf in prospect.prospect_industries.all %}
{% if inf.is_interested %}
count = count + 1;
{% endif %}
{% endfor %}
displayNotification(count + " " + zero); //I see 0 0 in the message
{% if count == 0 %}
displayNotification("Count is 0!!!!");
{% endif %}
我错过了什么?我尝试使用 "0" |add:0 来转换 count 变量,但没有任何效果,它永远不会进入 if 检查 if count == 0。
感谢您的帮助!
【问题讨论】:
标签: html django django-models django-templates