[Answer]-Django template: dynamic variable name in javascript

1👍

You have to write the value selection in Javascript:

var ratings = {beauty: {{u_list.beauty}}, wealth: {{u_list.wealth}}, age: {{u_list.age}} }
function SomeFunction(attribute) {
    var prev_rating = ratings[attribute]
}
👤Daniel

Leave a comment