finish that a tag in topics view
This commit is contained in:
@ -13,6 +13,20 @@ import time
|
||||
bp = Blueprint("threads", __name__, url_prefix = "/threads/")
|
||||
|
||||
|
||||
def get_post_url(post_id, _anchor=False):
|
||||
post = Posts.find({'id': post_id})
|
||||
if not post:
|
||||
return ""
|
||||
|
||||
thread = Threads.find({'id': post.thread_id})
|
||||
|
||||
res = url_for('threads.thread', slug=thread.slug, after=post_id)
|
||||
if not _anchor:
|
||||
return res
|
||||
|
||||
return f"{res}#post-{post_id}"
|
||||
|
||||
|
||||
@bp.get("/<slug>")
|
||||
def thread(slug):
|
||||
POSTS_PER_PAGE = 10
|
||||
|
Reference in New Issue
Block a user