1
stillwater 2014 年 10 月 30 日
用ifequal?
|
2
virusdefender 2014 年 10 月 30 日 {% ifequal a "111" %}{% endifequal %}判断相等
|
3
ericls 2014 年 10 月 30 日 via Android if house.status == 1应该可以
注意必须有空格 |
4
cheyo OP |
5
rcmerci 2014 年 10 月 30 日
模板里空格挺严格的
|
6
mornlight 2014 年 10 月 30 日
要有空格,如果你用Pycharm的话应该会提示你
|
7
taobeier 2014 年 10 月 31 日
不太习惯的话, 就用个IDE会稍微好点。
|
8
tuteng 2014 年 10 月 31 日
mark
|
9
gevin 2014 年 10 月 31 日
如果house.status的类型是str,你的代码那个就成了:
{% if 1=='1' %} 这种情况下就会报错 需要保持 '==' 两边值得类型一致 |
10
nooper 2014 年 10 月 31 日
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.
|