标签:nbsp value pos length request filter inpu one 评论列表
@app.route(‘/comments‘,methods=["POST"]) @login_first def comments(): comment = request.form.get("detail1") author_id = Question.query.filter(User.username == session.get(‘user‘)).first().id ques_id = request.form.get("question_id") comm = Comment(detail=comment, author_id=author_id,question_id=ques_id) db.session.add(comm) db.session.commit() return redirect(url_for(‘detail‘,question_id=ques_id))
<form action="{{ url_for("comments") }}" method="post"> <div> <textarea style="width: 400px" id="xiang" rows="5" name="detail1" placeholder="请输入您的评论"></textarea><br> <input style="display: none" value="{{ ques.id }}" name="question_id"/> <input type="submit" value="发送" style="width:45px;height:25px;font-size:15px"> </div> </form> <div> <h4 >评论:({{ ques.comment|length }})</h4>
标签:nbsp value pos length request filter inpu one 评论列表
原文地址:http://www.cnblogs.com/yin-yeah/p/8004825.html