Python - Building a Webapp: Web Development - Flask, HTML, Jinja, form, action, post
Head First Python: A Learner’s Guide to the Fundamentals of Python Programming, A Brain-Friendly Guide、 Paul Barry(著)、 O’Reilly Mediaの Chapter 7.(Building a Webapp: Web Development)、CODE MAGNETS(373/682)の解答を求めてみる。
コード
webapp/app.py
@app.post('/showfiles')
def display_swimmer():
name = request.form['swimmer']
populate_data()
print(session['swimmers'])
return render_template(
'select.html.j2',
title='Select an event',
url='/showbarchart',
select_id='file',
data=session['swimmers'][name],
)