forked from mrlan/EnglishPal
admin_service.py: show article content for the newly added article after clicking the button '保存'.
parent
472c0c115f
commit
18c37d583a
|
@ -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", "")
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue