@app.route('/comment/', methods=['POST'])
@loginFrist
def comment():
comment_detail = request.form.get('new_comment')
quest_id = request.form.get('question_id')
author_id = User.query.filter(User.username == session.get('user')).first().id
comment = Comment(detail=comment_detail, author_id=author_id, question_id=quest_id, )
db.session.add(comment)
db.session.commit()
return redirect(url_for('detail', question_id=quest_id))
<form role="form" action="{{ url_for('comment') }}" method="post">
<div class="form-group">
<label for="exampleInputEmail1">Write down your answer~~</label>
<textarea class="form-control" id="exampleInputEmail1" name="new_comment"></textarea>
<input type="hidden" name="question_id" value="{{ quest.id }}">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>