views.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:isthislegit 作者: duo-labs 项目源码 文件源码
def templates():
    if request.method == "GET":
        templates = Template.domain_query(g.domain).fetch()
        return render_template("templates.html", templates=templates)

    form = TemplateForm(request.form, domain=g.domain)
    if form.validate_on_submit():
        template = Template(
            name=form.name.data,
            text=form.text.data,
            subject=form.subject.data,
            sender=g.user.email(),
            owner_domain=g.domain,
            created_by=g.user.email())
        template.put()
        return jsonify(template.to_dict())
    return json_error(400, list_errors(form), {})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号