From a69e0cc27e41d9b71d23b94cf8bc1421dbba14df Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sun, 25 Jul 2021 22:58:20 +0000 Subject: add page links nav thing --- apioforum/forum.py | 5 +++-- apioforum/templates/view_forum.html | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apioforum/forum.py b/apioforum/forum.py index 69a05c5..3a5dbe3 100644 --- a/apioforum/forum.py +++ b/apioforum/forum.py @@ -75,8 +75,7 @@ def view_forum(forum_id,page=1): # XXX: update this when thread filtering happens num_threads = db.execute("SELECT count(*) AS count FROM threads WHERE threads.forum = ?",(forum_id,)).fetchone()['count'] - num_pages = math.ceil(num_threads/THREADS_PER_PAGE) - + max_pageno = math.ceil(num_threads/THREADS_PER_PAGE) thread_tags = {} thread_polls = {} @@ -137,6 +136,8 @@ def view_forum(forum_id,page=1): thread_tags=thread_tags, thread_polls=thread_polls, avail_tags=avail_tags, + max_pageno=max_pageno, + page=page, ) @bp.route("//create_thread",methods=("GET","POST")) diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html index 475fdc2..9c3c2c5 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -92,5 +92,19 @@ please log in to create a new thread {%endfor%} + + + + {%endblock%} -- cgit v1.2.3