I ask a very similar question like this yesterday and was directed here. I took what was posted there (using a session) to take in a user input, update a second page with a data table. However, If I get to that second route through any other means, it resorts back to the default which is an empty data table. So I'm thinking that the variable is not being updated and saved or being rewritten. Code below
@app.route('/', methods=['GET','POST'])
def index():
loadform = LoadDataForm()
session['dataset'] = toy_data.get_empty_df()
if loadform.validate_on_submit():
dataset, headers = toy_data.get_dataset(int(loadform.selectToyData.data))
session['dataset'] = dataset
session.modified = True
return render_template('DataTable.html',dataset=dataset)
return render_template('LoadData.html',form=loadform)
@app.route('/DataTable', methods=['GET','POST'])
def index_data():
dataset = session.get('dataset',None)
return render_template('DataTable.html',dataset=dataset)