код python возвращает столбцы и строки,
cur.execute("select * from job_log")
row_headers = [x[0] for x in cur.description]
rv = cur.fetchall()
results = []
for result in rv:
results.append(dict(zip(row_headers, result)))
return results
результат этого:
[
{
"job_name": "Test",
"job_status": "Completed with Error"
}
]
что я хочу, это
data = [{
"job_name": "Test",
"job_status": "Completed with Error"
}]
columns = [{
"field": "job_name", # which is the field's name of data key
"title": "job_name", # display as the table header's name
},
{
"field": "job_status", # which is the field's name of data key
"title": "job_status", # display as the table header's name
}
]
мой другой python вызывает шаблон html bootstrap и показывает данные.
def index():
return render_template("table.html",data=data,columns=columns,title='Flask Bootstrap Table')