오히려 좋아..

상황이 나쁘게만 흘러가는 것 같을 때 외쳐보자.. .

궁금한 마음으로 포트폴리오 보기

Web Programming/Django

[Django] Django Template 인덱스 사용하기

junha6316 2021. 2. 22. 09:10

 

{% for item in item_list %}
    {{ forloop.counter }} # starting index 1
    {{ forloop.counter0 }} # starting index 0	
    # do your stuff
{% endfor %}

stackoverflow.com/questions/11481499/django-iterate-number-in-for-loop-of-a-template

 

Django - iterate number in for loop of a template

I have the following for loop in my django template displaying days. I wonder, whether it's possible to iterate a number (in the below case i) in a loop. Or do I have to store it in the database an...

stackoverflow.com