def post(self, thread_id): try: thread = Thread.query.filter_by(id=thread_id).one() except NoResultFound: abort(404) form = ThreadReplyForm() if form.validate(): post = Post(form.content.data, thread, current_user.id) post.op = False db.session.add(post) db.session.commit() return redirect(url_for("forum.ThreadView:get_0", thread_id=thread_id, page=1)) # TODO: Redirect to last page of thread return render_template("forum_thread_reply.jinja2", form=form, thread=thread)
def post(self, board_text_id): try: board = Board.get_board_by_text_id(board_text_id) except NoResultFound: return abort(404) form = ThreadPostForm() if form.validate(): thread = Thread(form.title.data, board.id, current_user.id) db.session.add(thread) db.session.commit() post = Post(form.content.data, thread, current_user.id) post.op = True db.session.add(post) db.session.commit() return render_template("forum_thread_post.jinja2", board=board, form=form)