From e69ec565f78cfc3dbc1fe793d27c10778cad6012 Mon Sep 17 00:00:00 2001 From: 0x01fe Date: Wed, 26 Jun 2024 16:03:47 -0500 Subject: [PATCH] fixed post links and added comment stuff to posts page --- app/app.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/app.py b/app/app.py index 416bf54..b2a4ccc 100644 --- a/app/app.py +++ b/app/app.py @@ -145,8 +145,18 @@ def index(): def post(post_name: str): for post in get_posts(): - if post.title.replace(' ', '-') == post_name: - return flask.render_template('index.html', posts=[post.body], status=get_status()) + if post.title == post_name: + comments = comment.get_comments(post.title) + + if 'username' in flask.session: + user = flask.session['username'] + else: + user = 'Anon' + + # Setup Comment Form + form = comment.CommentForm() + + return flask.render_template('index.html', posts=[[{'body': post.body, 'title': post.title}, comments]], status=get_status(), form=form, user=user) flask.abort(404)