aboutsummaryrefslogtreecommitdiffhomepage
path: root/apioforum/thread.py
diff options
context:
space:
mode:
authorubq323 <ubq323>2021-06-15 19:12:30 +0000
committerubq323 <ubq323>2021-06-15 19:12:30 +0000
commitf2fb2736afac2326a8ed16d702a9a6a2d10101d0 (patch)
tree1a7997cf9ee85e949249a612dad97c519d302f4d /apioforum/thread.py
parent8481d0c07475aee7b9ad4a6aa899bcc9af437e64 (diff)
display tags on thread page
Diffstat (limited to 'apioforum/thread.py')
-rw-r--r--apioforum/thread.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/apioforum/thread.py b/apioforum/thread.py
index 12ced72..e881a69 100644
--- a/apioforum/thread.py
+++ b/apioforum/thread.py
@@ -23,8 +23,12 @@ def view_thread(thread_id):
"SELECT * FROM posts WHERE thread = ? ORDER BY created ASC;",
(thread_id,)
).fetchall()
+ tags = db.execute(
+ """SELECT tags.* FROM tags
+ INNER JOIN thread_tags ON thread_tags.tag = tags.id
+ WHERE thread_tags.thread = ?""",(thread_id,)).fetchall()
rendered_posts = [render(q['content']) for q in posts]
- return render_template("view_thread.html",posts=posts,thread=thread,thread_id=thread_id,rendered_posts=rendered_posts)
+ return render_template("view_thread.html",posts=posts,thread=thread,rendered_posts=rendered_posts,tags=tags)
@bp.route("/<int:thread_id>/create_post", methods=("POST",))
def create_post(thread_id):