admin_service.py: show article content for the newly added article after clicking the button '保存'.

Bug511-Bosh
Lan Hui 2023-07-14 08:15:15 +08:00
parent 472c0c115f
commit 18c37d583a
2 changed files with 6 additions and 2 deletions

View File

@ -74,7 +74,10 @@ def article():
context["text_list"] = get_page_articles(_cur_page, _page_size) context["text_list"] = get_page_articles(_cur_page, _page_size)
_articles = get_page_articles(_cur_page, _page_size) _articles = get_page_articles(_cur_page, _page_size)
for article in _articles: # 获取每篇文章的title for article in _articles: # 获取每篇文章的title
article.title = article.text.split("\n")[0] text = escape(article.text) # Fix XSS vulnerability, contributed by Xu Xuan
article.title = text.split("\n")[0]
article.content = '<br/>'.join(text.split("\n")[1:])
context["text_list"] = _articles context["text_list"] = _articles
if request.method == "GET": if request.method == "GET":
@ -85,6 +88,7 @@ def article():
if delete_id: # delete article if delete_id: # delete article
delete_article_by_id(delete_id) delete_article_by_id(delete_id)
_update_context() _update_context()
elif request.method == "POST": elif request.method == "POST":
data = request.form data = request.form
content = data.get("content", "") content = data.get("content", "")

BIN
app/static/wordfreqapp.db Normal file

Binary file not shown.