添加文章成功后,修改用户信息成功后,页面显示成功信息(flash messages)。

Alpha
Lan Hui 2023-03-26 09:44:39 +08:00
parent fb6d0b23ce
commit 3bc61a602f
3 changed files with 17 additions and 3 deletions

View File

@ -97,7 +97,8 @@ def article():
return "Level must be between 1 and 5"
add_article(content, source, level, question)
_update_context()
title = content.split('\n')[0]
flash(f'Article added. Title: {title}')
return render_template("admin_manage_article.html", **context)
@ -119,7 +120,8 @@ def user():
if username:
if new_password:
update_password_by_username(username, new_password)
flash(f'Password updated to {new_password}')
if expiry_time:
update_expiry_time_by_username(username, "".join(expiry_time.split("-")))
flash(f'Expiry date updated to {expiry_time}.')
return render_template("admin_manage_user.html", **context)

View File

@ -30,6 +30,12 @@
</div>
</nav>
{% for message in get_flashed_messages() %}
<div class="alert alert-success" role="alert">
{{ message }}
</div>
{% endfor %}
<div class="card" style="margin-top:24px;">
{% if tips %}
<div class="alert alert-success" role="alert">

View File

@ -31,6 +31,12 @@
</div>
</nav>
{% for message in get_flashed_messages() %}
<div class="alert alert-success" role="alert">
{{ message }}
</div>
{% endfor %}
<div class="card" style="margin-top:24px;">
<h5 style="margin-top: 10px;padding-left: 10px;">重置选中用户的信息</h5>
<form id="user_form" action="" method="post" class="container mb-3">