Skip to content
Advertisement

Jinja loop.index does not print

When running the following jinja code, I only get “Column info” printed. Why the index does not appears ?

JavaScript

Advertisement

Answer

It sounds like the template is being treated as a Django template, not a Jinja template.

Using {{ loop.index }} should work in a Jinja template, but wouldn’t work in a Django template, where you would use {{ forloop.counter }} instead.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement