From 47b68768d6b13c93bc6f4544754427daa696f9d7 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 19 Jun 2021 20:25:49 +0000 Subject: sort tags by tag id so they always appear in the same order --- apioforum/forum.py | 3 ++- apioforum/thread.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apioforum/forum.py b/apioforum/forum.py index 98c71f7..30e29cb 100644 --- a/apioforum/forum.py +++ b/apioforum/forum.py @@ -29,7 +29,8 @@ def view_forum(): thread_tags[thread['id']] = db.execute( """SELECT tags.* FROM tags INNER JOIN thread_tags ON thread_tags.tag = tags.id - WHERE thread_tags.thread = ?; + WHERE thread_tags.thread = ? + ORDER BY tags.id; """,(thread['id'],)).fetchall() return render_template("view_forum.html",threads=threads,thread_tags=thread_tags) diff --git a/apioforum/thread.py b/apioforum/thread.py index 292fd21..ad02b68 100644 --- a/apioforum/thread.py +++ b/apioforum/thread.py @@ -26,7 +26,8 @@ def view_thread(thread_id): tags = db.execute( """SELECT tags.* FROM tags INNER JOIN thread_tags ON thread_tags.tag = tags.id - WHERE thread_tags.thread = ?""",(thread_id,)).fetchall() + WHERE thread_tags.thread = ? + ORDER BY tags.id""",(thread_id,)).fetchall() rendered_posts = [render(q['content']) for q in posts] return render_template("view_thread.html",posts=posts,thread=thread,rendered_posts=rendered_posts,tags=tags) -- cgit v1.2.3