So, here’s a problem I’ve been facing.
Consider this scenario:
data = {
"images": {
108: {"file1": "img11.jpg", "file2": "img12.jpg"},
109: {"file1": "img21.jpg", "file2": "img12.jpg"}
}
}
Now, {{this.id}}
outputs the value 108
and {{data.images.108.file1}}
correctly outputs the value img11.jpg
.
However, I want to dynamically pass this.id
instead of hardcoding 108. How can I do this in Jinja?
Any advice would be extremely appreciated.
I tried {{data.images.this.id.file1}}
, {{data.images.[this.id].file1}}
and {{data.images.get(this.id).file1}}
but none worked.