发布时间:2019-07-09 09:32:48编辑:auto阅读(2047)
1、views 示例
from flask import render_template, redirect, url_for, Flask, flash, session, request @admin.route("/account/del/<int:id>/", methods=["GET"]) @admin_login_req def account_del(id=None): from app.models import db print(id) account = Account.query.filter_by(id=id).first_or_404() print(account) db.session.delete(account) db.session.commit() flash("删除记录成功!", "ok") # 消息闪现 return redirect(url_for('admin.account_list', page=1))
2、模板示例
{% for msg in get_flashed_messages(category_filter=["ok"]) %} <div class="king-notice2 king-notice-success notice-borders"> <i class="fa fa-check-circle"></i> <div class="notice-text"> <p>{{ msg }}</p> </div> </div> {% endfor %}
消息闪现参考文档:http://www.pythondoc.com/flask/patterns/flashing.html
上一篇: python 内置模块collectio
下一篇: [Unity3D]关于U3D贴图格式压缩
47479
45781
36780
34300
28950
25585
24431
19602
19089
17623
5454°
6037°
5553°
5628°
6554°
5365°
5366°
5872°
5845°
7159°