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