Flash message is informative. Why not add it?

Bug511-Bosh
Lan Hui 2023-08-11 19:14:51 +08:00
parent dff560cc73
commit f4df263d6e
3 changed files with 8 additions and 4 deletions

BIN
app/static/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -55,9 +55,9 @@
<a class="btn btn-secondary" href="/reset" role="button" onclick="stopRead()">重设密码</a>
</p>
{# {% for message in flashed_messages %}#} {# 根据user_service.userpage,取消了参数flashed_messages因此注释了这段代码 #}
{# <div class="alert alert-warning" role="alert">Congratulations! {{ message }}</div>#}
{# {% endfor %}#}
{% for message in get_flashed_messages() %}
<div class="alert alert-warning" role="alert">{{ message }}</div>
{% endfor %}
<button class="btn btn-success" id="load_next_article" onclick="load_next_article();Reader.stopRead()"> 下一篇 Next Article </button>
<button class="btn btn-success" id="load_pre_article" onclick="load_pre_article();Reader.stopRead()" style="display: none"> 上一篇 Previous Article </button>

View File

@ -181,7 +181,11 @@ def user_mark_word(username):
for word in request.form.getlist('marked'):
lst.append((word, [get_time()]))
d = pickle_idea2.merge_frequency(lst, lst_history)
if len(lst_history) > 999:
flash('You have way too many words in your difficult-words book. Delete some first.')
else:
pickle_idea2.save_frequency_to_pickle(d, user_freq_record)
flash('Added %s.' % (', '.join(request.form.getlist('marked'))))
return redirect(url_for('user_bp.userpage', username=username))
else:
return 'Under construction'