datatables
datatables copied to clipboard
Flask-Alchemy
Hi,
Thank you for this amazing module! It really does help as all the datatables examples that i've seen are PHP.
I've got a flask-alchemy project with flask-restless for REST API. Would you have an example or explanation of the lines:
@view_config(route_name="data", request_method="GET", renderer="json")
def users_data(request):
In the views.py sample file.
my views are more like
@app.route('/api/user', methods=['GET', 'POST'])
def users_data(request):
Thank you
Hey there, thanks for the kind words :)
The example uses the Pyramid framework and you are using Flask, you can ignore them in the example (It's just boilerplate). The bit inside the function:
table = DataTable(request.GET, User, User.query, [
"id",
("name", "full_name", lambda i: "User: {}".format(i.full_name)),
("address", "address.description"),
])
...
should still be the same.
Hi, thank you for this module. That's so amazing! I have another question about sqlalchemy with flask, if i'm not using orm, how to change my code like
table = DataTable(request.GET, User, User.query, [
"id",
("name", "full_name", lambda i: "User: {}".format(i.full_name)),
("address", "address.description"),
])
...
Thanks !