【发布时间】:2014-08-11 02:37:48
【问题描述】:
我的网络应用目前有 3 个页面。我在第一页上获得了用户输入,并将其传递给了我的 view.py,并计算了我的第二页所需的一些变量。我想将第二页中存在的变量传递到第三页,但不知道如何去做。有关如何修改第二页的 html 以实现此目的的任何建议?
到目前为止,我通过在 view.py 中将变量设为全局变量来解决这个问题。这似乎可行,但似乎不是一个可行的长期解决方案。
谢谢!
existing variables: thePrediction, theData
第二页的html:
<div class = "caption-full">
<h3>Currently, I have a {{thePercentage}} chance of getting adopted.</h3>
{% if thePrediction[1] + thePrediction[2] >0%}
<form action="/third_page" method="GET">
<button class="btn btn-large btn-info" >Go to third page</button>
</form>
{% endif %}
</div>
【问题讨论】:
标签: python html twitter-bootstrap flask