diff --git a/app/admin_service.py b/app/admin_service.py index 9cd093a..2a295af 100644 --- a/app/admin_service.py +++ b/app/admin_service.py @@ -89,7 +89,7 @@ def article(): flash(f'Article ID {delete_id} deleted successfully.') # 刷新页首提示语 _update_context() except ValueError: - flash('Invalid article ID for deletion.') + flash('Invalid article ID for deletion.') # 刷新页首提示语 content = data.get("content", "") source = data.get("source", "") @@ -99,9 +99,9 @@ def article(): if level not in ['1', '2', '3', '4']: return "Level must be between 1 and 4." add_article(content, source, level, question) - _update_context() title = content.split('\n')[0] flash(f'Article added. Title: {title}') + _update_context() # 这行应在flash之后 否则会发生新建的文章即点即删 return render_template("admin_manage_article.html", **context)