django for 循环中,或者序号

模板的for循环中,如何获取序号?

想过用enumerate,但是在模板中会报错 Could not parse the remainder xxx;

后来搜到 forloop.counter,完美解决

参考:http://www.cnblogs.com/chenkeven/articles/9340961.html

猜你喜欢

转载自www.cnblogs.com/dannyyao/p/9948910.html