6
Anket formum var. Formu gönderdikten sonra, verileri kaydetmeyi ve daha sonra "başarılı" bir görünüme yönlendirmeyi istiyorum. Şu anda şu kodu kullanıyorum, ancak şu anki URL'de kalıyor, /success
'a gitmek istiyorum. Bunu nasıl yapabilirim?Form verdikten sonra diğer görünümlere yönlendirme
@app.route('/surveytest', methods=['GET', 'POST'])
def surveytest():
if request.method == 'GET':
return render_template('test.html', title='Survey Test', year=datetime.now().year, message='This is the survey page.')
elif request.method == 'POST':
name = request.form['name']
address = request.form['address']
phone = request.form['phone']
email = request.form['email']
company = request.form['company']
return render_template('success.html', name=name, address=address, phone = phone, email = email, company = company)
Ayrıca, [hızlı mesajlar] da kullanabilirsiniz (http://flask.pocoo.org/docs/0.10/patterns/flashing/). – dirn