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), {})
评论列表
文章目录