У меня есть вопрос относительно таблицы Python mysql db в Bootstrap.
Мой вопрос - мои данные не отображаются в таблице.Я вижу, что он получает данные, потому что, когда я добавляю строку в MySQL DB с данными, таблица увеличивается.
код app.py:
@app.route('/dashboard')
@is_logged_in
def dashboard():
#create cursor
cur = mysql.get_db().cursor()
#Get data
result = cur.execute("SELECT * FROM test")
data=cur.fetchall()
if result > 0:
return render_template('dashboard.html', data=data)
else:
msg = 'No DOC Found'
return render_template('dashboard.html', msg=msg)
#close connection
cur.close()
return render_template('dashboard.html' )
.html
<table class="table table-striped">
<tr>
<th>data1</th>
<th>data2</th>
</tr>
{% for test in data%}
<tr>
<td>{{test.rdno}}</td>
<td>{{test.ipno}}</td>
{% endfor %}
</tr>
</table>