回答編集履歴

1

追記

2021/07/30 03:13

投稿

quickquip
quickquip

スコア11038

test CHANGED
@@ -1,3 +1,19 @@
1
1
  [https://docs.djangoproject.com/ja/3.2/ref/templates/builtins/#std:templatetag-for](https://docs.djangoproject.com/ja/3.2/ref/templates/builtins/#std:templatetag-for)
2
2
 
3
3
  `forloop.counter0`じゃないでしょうか。
4
+
5
+
6
+
7
+ ----
8
+
9
+
10
+
11
+ そうでした。`[]`でのアクセスかできないんでした。
12
+
13
+ [https://stackoverflow.com/questions/4651172/reference-list-item-by-index-within-django-template#answer-29664945](https://stackoverflow.com/questions/4651172/reference-list-item-by-index-within-django-template#answer-29664945)
14
+
15
+ のようにカスタムフィルタを作成する方法があります。
16
+
17
+
18
+
19
+ Django的には、renderを呼び出す側でparamsで渡す時点でループで回したいデータが`zip`関数でまとられていることが想定されていると思います。