From 4303ff93359c42e61cb7362932a4433d4d51cf1b Mon Sep 17 00:00:00 2001 From: jwansek Date: Tue, 24 Mar 2026 18:33:56 +0000 Subject: Added page for each question --- edaweb/app.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'edaweb/app.py') diff --git a/edaweb/app.py b/edaweb/app.py index ab2aa0c..0d4458a 100644 --- a/edaweb/app.py +++ b/edaweb/app.py @@ -17,7 +17,7 @@ import io app = flask.Flask(__name__) CONFIG = configparser.ConfigParser(interpolation = None) -CONFIG.read(os.path.join(os.path.dirname(__file__), "edaweb.conf")) +CONFIG.read(os.path.join(os.path.dirname(__file__), "..", "edaweb.conf")) shown_images = set() shown_sidebar_images = set() @@ -27,7 +27,6 @@ def get_pfp_img(db:database.Database): if len(shown_images) == len(dbimg): shown_images = set() folder = set(dbimg).difference(shown_images) - print(folder) choice = random.choice(list(folder)) shown_images.add(choice) return choice @@ -249,6 +248,18 @@ def serve_questions(): qnas_link = CONFIG.get("qnas", "url"), qnas = db.get_qnas() ) + +@app.route("/question") +def serve_question(): + with database.Database() as db: + question_id = flask.request.args.get("id", type=int) + qna = db.get_qna(question_id) + return flask.render_template( + "question.html.j2", + **get_template_items("question from %s" % qna["qna"][2], db), + qnas_link = CONFIG.get("qnas", "url"), + qna = qna + ) if __name__ == "__main__": try: -- cgit v1.2.3