22
Sep.2011
模型中做了一个选择型字段,模板中需要调用,一开始一直在用这样,感觉太繁琐了
{% ifequal tran_plan.traffic 1 %}
飞机
{% endifequal %}
{% ifequal tran_plan.traffic 2 %}
汽车
{% endifequal %}
{% ifequal tran_plan.traffic 3 %}
轮船
{% endifequal %}
{% ifequal tran_plan.traffic 4 %}
火车
{% endifequal %}
今天在群里经群友提点才知道有这种方法
选择型字段在模板里面可以直接用
真是太帅了!
{% ifequal tran_plan.traffic 1 %}
飞机
{% endifequal %}
{% ifequal tran_plan.traffic 2 %}
汽车
{% endifequal %}
{% ifequal tran_plan.traffic 3 %}
轮船
{% endifequal %}
{% ifequal tran_plan.traffic 4 %}
火车
{% endifequal %}
今天在群里经群友提点才知道有这种方法
选择型字段在模板里面可以直接用
tran_plan.get_traffic_display
来显示!真是太帅了!
相关日志
ecshop自定义模板标签
在ECSHOP首页今日特价(促销商品)增加倒计时限时抢购效果
ecshop中 <!-- {if $cat_rec_sign neq 1} --> 的作用
SAE Python Django试用笔记(二)
smart模板
ecshop自定义模板标签
在ECSHOP首页今日特价(促销商品)增加倒计时限时抢购效果
ecshop中 <!-- {if $cat_rec_sign neq 1} --> 的作用
SAE Python Django试用笔记(二)
smart模板
