DTL中的IF

代码1,使用if判断大小

views.py文件:
from django.shortcuts import render
def index(request):
context = {
“age”:17
}
return render(request,‘index.html’,context=context)

index.html文件:

Title {% if age < 18 %}

你是未成年人不可以进入网吧

{% elif age == 18 %}

你已经18岁了可以进入网吧了

{% else %}

你已经是成年人了,需要承担家庭的责任

{% endif %}

代码2 if in:

views.py文件:
from django.shortcuts import render

def index(request):
context = {
“heros”:[
“关羽”,
“赵云”
]
}
return render(request,‘index.html’,context=context)

index.html文件:

Title {% if "项羽" in heros %}

项羽待命

{% else %}

项羽下线了

{% endif %}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
解释下Peoplesoft的这段代码 Component array of array of any &tmpArray; Local Record &rec1, &rec2; &rec1 = CreateRecord(Record.HIK_IPSANRS_TBL); &rec2 = CreateRecord(Record.HIK_IPSAN_TBL); Local Rowset &rsLvl1, &rsDtl; Local number &i, &j; Local Row &row; &rsLvl1 = GetLevel0()(1).GetRowset(Scroll.WPS_STR_INF_TBL); For &i = 1 To &rsLvl1.ActiveRowCount &rsDtl = &rsLvl1(&i).GetRowset(Scroll.WPS_STR_DTL_TBL); For &j = 1 To &rsDtl.ActiveRowCount &row = &rsDtl(&j); If Not &row.IsDeleted Then If All(&row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value) Then &rec1 = CreateRecord(Record.WPS_IPSANRS_TBL); &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; If &rec1.SelectByKey() Then &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec1.STATUS.Value = &rsLvl1(&i).WPS_STR_INF_TBL.STATUS.Value; &rec1.Update(); Else &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec1.STATUS.Value = "A"; &rec1.Insert(); End-If; &rec2 = CreateRecord(Record.WPS_IPSAN_TBL); &rec2.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec2.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec2.WPS_STORID.Value = &row.WPS_STR_DTL_TBL.WPS_STORID.Value; &rec2.WPS_GP_WAGECODE.Value = &row.WPS_STR_DTL_TBL.WPS_GP_WAGECODE.Value; If Not &rec2.Insert() Then &rec2.Update(); End-If; End-If; End-If; End-For; End-For;
最新发布
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值