diff options
-rw-r--r-- | apioforum/__init__.py | 10 | ||||
-rw-r--r-- | apioforum/templates/base.html | 6 | ||||
-rw-r--r-- | apioforum/templates/view_forum.html | 2 | ||||
-rw-r--r-- | apioforum/thread.py | 2 |
4 files changed, 14 insertions, 6 deletions
diff --git a/apioforum/__init__.py b/apioforum/__init__.py index 7baa7c1..c4348a3 100644 --- a/apioforum/__init__.py +++ b/apioforum/__init__.py @@ -1,7 +1,7 @@ # boilerplate boilerplate boilerplate # yay -from flask import Flask +from flask import Flask, request from .db import get_db import os @@ -32,6 +32,14 @@ def create_app(): from .fuzzy import fuzzy app.jinja_env.filters['fuzzy']=fuzzy + @app.context_processor + def path_for_next(): + p = request.path + if len(request.query_string) > 0: + p += "?" + request.query_string.decode("utf-8") + return dict(path_for_next=p) + + app.add_url_rule("/",endpoint="index") return app diff --git a/apioforum/templates/base.html b/apioforum/templates/base.html index 1802ee5..5121b85 100644 --- a/apioforum/templates/base.html +++ b/apioforum/templates/base.html @@ -21,18 +21,18 @@ {% if g.user %} <p>{{ g.user }}</p> <p> - <a href="{{ url_for('auth.logout',next=request.path) }}"> + <a href="{{ url_for('auth.logout',next=path_for_next) }}"> logout </a> </p> {% else %} <p> - <a href="{{ url_for('auth.login',next=request.path) }}"> + <a href="{{ url_for('auth.login',next=path_for_next) }}"> login </a> </p> <p> - <a href="{{ url_for('auth.register',next=request.path) }}"> + <a href="{{ url_for('auth.register',next=path_for_next) }}"> register </a> </p> diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html index 22f24c1..3edb7f0 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -28,7 +28,7 @@ last updated </div> <div class="threadlisting-part threadlisting-part-lastactivityby threadlisting-header"> - last activity by + last post by </div> <div class="threadlisting-part threadlisting-part-numreplies threadlisting-header"> posts diff --git a/apioforum/thread.py b/apioforum/thread.py index 30b5d84..292fd21 100644 --- a/apioforum/thread.py +++ b/apioforum/thread.py @@ -76,7 +76,7 @@ def delete_post(post_id): flash("post deleted deletedly") return redirect(url_for("thread.view_thread",thread_id=post["thread"])) else: - return render_template("delete_post.html",post=post,rendered_content=render_md(post["content"])) + return render_template("delete_post.html",post=post,rendered_content=render(post["content"])) @bp.route("/edit_post/<int:post_id>",methods=["GET","POST"]) |