1

code in views.py. f is a list of lists.

f = [((1,2,3), (4,5,6)), ((1,2,3), (4,5,6))]

return render(request, 'site/blabla.html', {'f': f, 'n': 1})

code in blabla.html

{% for pr in f %}
#return empty    
<td>{{ pr.n }}</td>
#return value from the list
<td>{{ pr.1 }}</td>
{% endfor %}

How to make Django accept n as parameter? Or maybe there is another way to accomplish this?

nfl-x
  • 487
  • 1
  • 6
  • 13

1 Answers1

3

You may use custom-template-tags. For example here an answer:

get elemet by index

Brown Bear
  • 19,655
  • 10
  • 58
  • 76