摘要: 定义一个基类form,用于获取错误信息 from wtforms import Formclass BaseForm(Form): def get_error(self): # a = {'aaa': [xxx], 'bbb': [www]} a.popitem()[1][0]=xxx messag 阅读全文
posted @ 2019-11-22 23:17 向前走。 阅读(528) 评论(0) 推荐(0) 编辑
摘要: 顺便实现ajax提交的时候默认提交csrf_token var http = { 'get':function (args) { args['method'] = 'get'; this.ajax(args); }, 'post':function (args) { args['method'] = 阅读全文
posted @ 2019-11-22 22:38 向前走。 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 加上CSRF防御 修改密码页面 视图 class ResetPwd(views.MethodView): decorators = [login_required] # 校验登录状态 def get(self): return render_template('cms/cms_resetpwd.ht 阅读全文
posted @ 2019-11-22 21:56 向前走。 阅读(749) 评论(0) 推荐(1) 编辑
摘要: 模板抽取,将公共的页面抽出来作为模板 {% from 'common/_macros.html' import static %}<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title> {% block title % 阅读全文
posted @ 2019-11-22 21:07 向前走。 阅读(444) 评论(0) 推荐(0) 编辑