0
我編寫了一個自定義模板標籤get_item,它獲取索引並返回該索引的會話保持列表中的項目。我的問題是,似乎我無法在另一個模板命令標籤中訪問forloop.counter。在自定義模板標籤內訪問forloop.counter
{% for item in form %}
{% get_item {{ forloop.counter }} %} --> How do I get this working?
{{ item }}
{% endfor %}
我該如何克服這個問題?
謝謝!