5
I’m starting now with Flask
and I came across the following question: how do I define a table class using the flask_table
?
Follow my example code and the result:
from flask_table import Table, Col
class TabelaDados(Table):
codigo = Col('Código')
nome = Col('Nome')
ip = Col('Ip')
@app.route('/dados')
def dados():
dados_pc = TI.query.all()
table = TabelaDados(dados_pc)
print(table.__html__())
return render_template('dados.html', tabela=table)
Is returning the table correctly, but wanted to include a class css to the table.
Are you trying to implement an ORM? If you are trying I advise you to read more about sqlalchemy.
– urb