1
stillwater 2014-10-30 20:34:40 +08:00
用ifequal?
|
2
virusdefender 2014-10-30 20:35:24 +08:00 1
{% ifequal a "111" %}{% endifequal %}判断相等
|
3
ericls 2014-10-30 21:43:11 +08:00 via Android 1
if house.status == 1应该可以
注意必须有空格 |
4
cheyo OP |
5
rcmerci 2014-10-30 22:03:23 +08:00
模板里空格挺严格的
|
6
mornlight 2014-10-30 22:50:29 +08:00
要有空格,如果你用Pycharm的话应该会提示你
|
7
taobeier 2014-10-31 00:00:18 +08:00
不太习惯的话, 就用个IDE会稍微好点。
|
8
tuteng 2014-10-31 07:18:59 +08:00
mark
|
9
gevin 2014-10-31 13:43:52 +08:00
如果house.status的类型是str,你的代码那个就成了:
{% if 1=='1' %} 这种情况下就会报错 需要保持 '==' 两边值得类型一致 |
10
nooper 2014-10-31 17:24:27 +08:00
Try to remove the complex in the if cases.Just judge by integer , what if the status change , that's should not be hard code in the template. and you'd better add the logic into the views. or templatetags.
|