Why not just have that line read as:
<td><a href='/players/{{ player.player }}'>{{player.player}}</a></td>
No concatenation required, it'll be constructed before it hits the browser.
문제
I've been reviewing the Tornado API and I can't figure out how to concatenate two strings, where one is typed, and one is a variable. Tornado does not seem to inherit from Jinja2/Django templates.
The end goal is to use a dynamically generated variable as a GET request attribute. I could use a form with a hidden variable, but there are hundreds of generated values to be rendered at the same time.
I've included one example as a proof of work, but I've also tried examples using Django/Jinja2 templates. Any suggestions?
<div class="row">
<div class="small-6 columns">
<table>
<th>Name</th>
<th>Broken</th>
<th>Placed</th>
<th>Kills</th>
<th>Deaths</th>
{% for player in players %}
<tr>
<td><a href='/players/' + {{ player.player }}>{{player.player}}</a></td>
<td><a href="#">{{player.blocks_broken}}</a></td>
<td><a href="#">{{player.blocks_placed}}</a></td>
<td><a href="#">{{player.kills}}</a></td>
<td><a href="#">{{player.deaths}}</a></td>
</tr>
{% end %}
</table>
</div>
</div>
This results in the following URL: localhost:8888/players
The desired output is: localhost:8888/players/bob
해결책
Why not just have that line read as:
<td><a href='/players/{{ player.player }}'>{{player.player}}</a></td>
No concatenation required, it'll be constructed before it hits the browser.