django tmeplate 循环基数
2015-10-13 17:22
561 查看
{% for item in item_list %} {{ forloop.counter }} {# starting index 1 #} {{ forloop.counter0 }} {# starting index 0 #} do your stuff {%endfor%}
下面是demo,forloop.counter从1开始,forloop.counter0是从0开始
<!-- 题目 01--> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">{{ forloop.counter }} .{{item.tigan}}</h3> </div> <div class="panel-body"> <div style="margin-left:10px"> <label class="radio"><input type="radio" name="gender" value="0">男</input></label> <label class="radio"><input type="radio" name="gender" value="1">女</input></label> <label class="radio"><input type="radio" name="gender" value="2">其他</input></label> </div> </div> </div> <!-- 题目 01 end--> {% endfor %}
相关文章推荐
- django tmeplate 循环基数
- 2015年最新google地图可用API
- django下使用numpy、pandas、Scipy
- 动态链接库中函数的地址确定---PLT和GOT
- django model postgis的一些操作
- go程序包源码解读——golang.org/x/net/context
- 什么是测试开发工程师-google的解释
- LSGO软件技术团队爬山活动
- Golang 并发简介
- ZOJ 3232 - It's not Floyd Algorithm(强连通缩点+Floyd)
- MONGO DB windows 设备
- 【A Neural Algorithm of Artistic Style】 Pics
- 如何安装Google Authenticator
- virtualenv 隔离gjango开发环境
- 谷歌很多服务的IP已转回北京、上海
- 一个由Django的save方法引发的bug
- Django开发支持多帐号登录
- Xcode6中创建分类、协议等文件的方法
- beego 开发环境
- FusionCharts中文乱码+去logo资源