oTree Forum >

Access certain dictionary attributes in the html

#1 by r4z33n

on vars_for_template, im passing a dictionary i.e x = {"name": "something", "num" = 2 .....}
as return { 
        'elem' = x
        }
        ^ for example
        
in my html, I want to display certain attributes, such as {{ x["name"] }} so it displays "something", but it gives an un-parsable error. How do i tackle this situation? is there a way to parse such a thing, or do i have to break down the dictionary and pass in each attribute separately to call on in the HTML?

Thanks in advance

Write a reply

Set forum username