Получить данные строки таблицы HTML в функцию Flask ⇐ Python
-
Anonymous
Получить данные строки таблицы HTML в функцию Flask
I have an HTML table with several columns in the below template. The last column of the table has a button. The code is as follows.
index.html
{% for col in colnames %} {{ col }} {% endfor %} {% for record in records %} {% for col in colnames %} {{ record[col] }} {% endfor %} {% endfor %} When the user click the button of a specific row, I need to pass the value of the first column of the selected row to a Flask function and load another HTML page using this data.
Below is the flask back end function.
@app.route('/ct_edit') def ct_edit(): print('ct_edit') # the value of the first column of the selected row => ID # do something with the ID value and get a result return render_template('ct_edit.html', result=result) So far I'm unable to make this work. Can I please have any advice for this?
Источник: https://stackoverflow.com/questions/655 ... k-function
I have an HTML table with several columns in the below template. The last column of the table has a button. The code is as follows.
index.html
{% for col in colnames %} {{ col }} {% endfor %} {% for record in records %} {% for col in colnames %} {{ record[col] }} {% endfor %} {% endfor %} When the user click the button of a specific row, I need to pass the value of the first column of the selected row to a Flask function and load another HTML page using this data.
Below is the flask back end function.
@app.route('/ct_edit') def ct_edit(): print('ct_edit') # the value of the first column of the selected row => ID # do something with the ID value and get a result return render_template('ct_edit.html', result=result) So far I'm unable to make this work. Can I please have any advice for this?
Источник: https://stackoverflow.com/questions/655 ... k-function