summaryrefslogtreecommitdiffhomepage
path: root/apioforum/thread.py
diff options
context:
space:
mode:
Diffstat (limited to 'apioforum/thread.py')
-rw-r--r--apioforum/thread.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/apioforum/thread.py b/apioforum/thread.py
index 24b7766..2276e84 100644
--- a/apioforum/thread.py
+++ b/apioforum/thread.py
@@ -1,19 +1,22 @@
# view posts in thread
from flask import (
- Blueprint, render_template
+ Blueprint, render_template, abort
)
from .db import get_db
bp = Blueprint("thread", __name__, url_prefix="/thread")
-@bp.route("/view/<int:thread_id>")
+@bp.route("/<int:thread_id>")
def view_thread(thread_id):
db = get_db()
thread = db.execute("SELECT * FROM threads WHERE id = ?;",(thread_id,)).fetchone()
if thread is None:
abort(404)
else:
- posts = db.execute("SELECT * FROM posts WHERE thread = ? ORDER BY idx;",(thread_id,)).fetchall()
+ posts = db.execute(
+ "SELECT * FROM posts WHERE thread = ? ORDER BY created ASC;",
+ (thread_id,)
+ ).fetchall()
return render_template("view_thread.html",posts=posts,thread=thread)
-
+