diff options
author | ubq323 <ubq323> | 2021-06-19 20:25:49 +0000 |
---|---|---|
committer | ubq323 <ubq323> | 2021-06-19 20:25:49 +0000 |
commit | 47b68768d6b13c93bc6f4544754427daa696f9d7 (patch) | |
tree | 12fbce9e7e7f8dc1c9640742439f0d000319158f | |
parent | d56b760f15b0a7cdfc6e9f49bc95cc3d3f2f445f (diff) |
sort tags by tag id so they always appear in the same order
-rw-r--r-- | apioforum/forum.py | 3 | ||||
-rw-r--r-- | 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) |