我有一个页面/contact.html。它有一个按钮,当提交时将我带到用户登录的第二页(algo.html)。在第二页上,我有两个按钮,但我无法得到任何响应。这是我的代码:
@app.route('/contact', methods = ['GET', 'POST'])
def contact():
form = ContactForm()
if request.method == 'POST':
return render_template('algo.html')
if request.method == 'POST' and request.form['submit'] == 'swipeleft':
print "yes"
在contact.html我有:
<form action="{{ url_for('contact') }}" method=post>
{{ form.hidden_tag() }}
{{ form.name.label }}
{{ form.name }}
{{ form.submit }}
在 algo.html 我有:
<input type = "submit" name = "submit" value = "swipeleft" method=post>
<input type = "submit" name = "submit" value = "swiperight" method=post>