def update(): if request.method=='GET': id = request.args['id'] articlelist = ArticleType.getlist() blogs = DBSession().query(Blogs).filter_by(id=id).first() return render_template('blogs/update.html',blogs = blogs,articlelist=articlelist) form = request.form id = form.get('id') session = DBSession() blogs = session.query(Blogs).filter_by(id=id).scalar() blogs.title = form.get('title') blogs.content = form.get('content') blogs.classify = form.get('classify') blogs.state = form.get('state') blogs.synopsis = form.get('synopsis') session.commit() session.close() flash('修改成功!') return redirect(location='/blogs')
def update(): print 123 if request.method == "GET": id = request.args["id"] online = DBSession().query(Online).filter_by(id=id).first() return render_template("online/update.html", online=online) print 1234 form = request.form id = form.get("id") session = DBSession() online = session.query(Online).filter_by(id=id).scalar() online.title = form.get("title") online.content = form.get("content") online.classify = form.get("classify") online.state = form.get("state") online.synopsis = form.get("synopsis") session.commit() session.close() flash("修改成功!") return redirect(location="/online")