Pretty simple. I have a Python list that I am passing to a Django template.
I can specifically access the first item in this list using
{{ thelist|first }}
However, I also want to access a property of that item… ideally you’d think it would look like this:
{{ thelist|first.propertyName }}
But alas, it does not.
Is there any template solution to this, or am I just going to find myself passing an extra template variable…
You can access any item in a list via its index number. In a template this works the same as any other property lookup: