Python – Reference list item by index within Django template

djangodjango-templatespython

This may be simple, but I looked around and couldn't find an answer. What's the best way to reference a single item in a list from a Django template?

In other words, how do I do the equivalent of {{ data[0] }} within the template language?

Best Answer

It looks like {{ data.0 }}. See Variables and lookups.