I pass to the template:
testruns, which is "get_list_or_404(TestRun)"
and
dict, which is smth like this:
for testrun in testruns:
dict[testrun.id] = {
'passed' : bla bla,
'failed' : bla bla 2
}
Practically a map between testrun.id
and some other info from a set from TestRun Model
In the template I want to do this:
{% for testrun in testruns %}
console.log("{{ dict.testrun.id }}");
{% endfor %}
But doesn't output anything
console.log("{{ testrun.id }}");
will output a specific id ("37" for example)
console.log("{{ dict.37 }}");
will output the corresponding value from the dict
So, why doesn't this output anything?
console.log("{{ dict.testrun.id }}");
How should I get the data from 'passed'
and 'failed'
from the dict:
Also, this:
console.log("{{ dict[testrun.id] }}");
Will output this error:
TemplateSyntaxError at /path/dashboard
Could not parse the remainder: '[testrun.id]' from 'dict[testrun.id]'