开发者

Is there a Django template language equivalent to Python’s range()? [duplicate]

开发者 https://www.devze.com 2023-02-02 22:09 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: Numeric for loop in Django templates
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Numeric for loop in Django templates

In Python, if I开发者_运维技巧 want to run a loop nine times, I can do:

for i in range(1,10):

Is there an equivalent for the {% for %} tag in Django’s template language?


See this question.

Basically there is no support for it directly and you will need to write your own template tag for it or add it to the context your self. Either way isn't too big of a deal.

0

精彩评论

暂无评论...
验证码 换一张
取 消