python瓶消息闪现

  

1、视图示例

从瓶进口render_template,重定向,url_for,烧瓶,flash,会话、请求   @admin.route(“/账户/del/& lt; int: id>/?方法=(“获得”))   @admin_login_req   def account_del (id=None):   从app.models导入数据库   打印(id)   账户=Account.query.filter_by (id=id) .first_or_404 ()   print(账户)   db.session.delete(账户)   db.session.commit ()   flash(“删除记录成功!”,“好的”)#消息闪现   返回重定向(url_for(“管理。account_list’,页面=1))

2,模板示例

{%的味精get_flashed_messages (category_filter=[“ok”]) %}   & lt; div class=" king-notice2 king-notice-success notice-borders”比;   & lt;我类=" fa fa-check-circle "祝辞& lt;/i>   & lt; div类=皀otice-text”比;   & lt; p>{{味精}}& lt;/p>   & lt;/div>   & lt;/div>   {% endfor %}

消息闪现参考文档:http://www.pythondoc.com/flask/patterns/flashing.html

python瓶消息闪现