It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
7年前关闭。
对于早期版本,请使用
7年前关闭。
{% if {{result}} == 'Invalid' %}
<span class="error-message-uname">Invalid .</span>
{% endif %}
最佳答案
这取决于你使用的是什么版本的Django。Since Django 1.2,这是有效的:
{% if result == 'Invalid' %}
<span class="error-message-uname">Invalid .</span>
{% endif %}
对于早期版本,请使用
ifequal
:{% ifequal result 'Invalid' %}
<span class="error-message-uname">Invalid .</span>
{% endifequal %}
关于python - Django模板中是否使用正确的方法? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4468969/
10-11 09:21