Reputation: 39
I got a bunch of variables and would like to return with Flask. However, as you can see, I typed a long list, which seems stupid. May I know if there is any smarter way to deal with this? Thank you in advance.
return render_template('after.html',
Char1=Char1,
Char2=Char2,
Char3=Char3,
Char4=Char4,
Char5=Char5,
Char6=Char6,
Char7=Char7,
Char8=Char8,
graphJSON1 = graphJSON1,
graphJSON2 = graphJSON2)
Upvotes: 0
Views: 105
Reputation: 68
I suggest you put these values in a dictionary and then access this dictionary in you page
your_char_dict = {[1,Char1],[2,Char2],[3,Char3]}
your_graph_JSON = {"graphJSON1": graphJSON1, "graphJSON2": graphJSON2}
return render_template('after.html', your_char_dict, your_graph_JSON)
But note, that this might not work out of the box
Upvotes: 1