Postingan lainnya
Flash message tidak tampil
ini kode flask saya
@app.route('/Login', methods=['GET','POST'])
def show_login():
if request.method == 'POST':
resp = make_response('your email is ' + request.form['email'])
resp.set_cookie('email_user', request.form['email'])
session['username'] = request.form['email']
flash("login is success!", "success")
return redirect(url_for('show_profile', username= session['username']))
if 'username' in session:
username = session['username']
return redirect(url_for('show_profile', username=username))
return render_template('inihtml.html')
ini kode template html saya
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messsages %}
<ul class=flashes>
{% for category, message in messages%}
<li class="{{ category }}">{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
mohon bantuannya
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban