def add(): u = current_user() if not u: return redirect(url_for("auth.login")) if request.method == "GET": boards = Board.all() return render_template("topic/add.html", user_id=u.id, boards=boards) Topic.new_and_save(request.form) return redirect(url_for(".index"))
def index(): board_id = request.args.get("board", None) if board_id: board_id = int(board_id) topics = get_topics(board_id) boards = Board.all() user = current_user() return render_template("topic/index.html", user=user, topics=topics, board_id=board_id, boards=boards)