我是 javascript 中的变量类型表,我需要if在此变量和 django 数据库中的变量之间使用条件进行测试,但它不起作用。
这个例子 :
var test_date = "2017-06-23";
var locations = [
{% for v in vs %}
{% if v.date == test_date %}
['okok',{{ v.latitude }},{{ v.longitude}}],
{% endif %}
{% endfor%}
]
Run Code Online (Sandbox Code Playgroud)
第一个例子不起作用,我不知道为什么。
另一个例子:
var test_date = "2017-06-23";
var locations = [
{% for v in vs %}
{% if v.date == "2017-06-23" %}
['okok',{{ v.latitude }},{{ v.longitude}}],
{% endif %}
{% endfor%}
]
Run Code Online (Sandbox Code Playgroud)
当我将变量的值放入测试中时,它正在工作