I'm trying to return data from a function and render to be shown in the front-end, I'm using the tornado framework.
equipos = [x[0] for x in run_query("SELECT mac FROM equipos WHERE estado = 1")]
for equipo in equipos:
if self.current_user != "admin":
nombres[sonometro] = [x[0] for x in run_query("SELECT nombre FROM user_equipos a, equipos b WHERE a.id = b.mac AND a.id = '%s' AND a.usuario = '%s'" % (equipo,self.current_user))]
else:
nombres[sonometro] = [x[0] for x in run_query("SELECT nombre FROM equipos WHERE mac = '%s'" % equipo)]
self.render("list.html", host = host, equipos=nombres)
And in the view I have the following:
<div class="container">
{% if equipos %}
<h2> Los equipos conectados son: </h2>
<ul>
{% for equipo,alias in equipos.items() %}
<li> <a href="http://{{ host }}/view/{{ id }}"> {{alias}} </a> </li>
{% end %}
</ul>
{% else %}
<h2> No hay equipos conectados </h2>
{%end %}
</div>
This if I return the list, but the name of the team is showing it to me as a List and not as a string.