diff --git a/suchwow/app.py b/suchwow/app.py index 6e2dab0..6957dce 100644 --- a/suchwow/app.py +++ b/suchwow/app.py @@ -28,13 +28,17 @@ app.register_blueprint(leaderboard.bp) def index(): itp = 20 page = request.args.get("page", 1) + submitter = request.args.get("submitter", None) try: page = int(page) except: flash("Wow, wtf hackerman. Cool it.") page = 1 - posts = Post.select().order_by(Post.timestamp.desc()).paginate(page, itp) + posts = Post.select().order_by(Post.timestamp.desc()) + if submitter: + posts = posts.where(Post.submitter == submitter) + posts = posts.paginate(page, itp) total_pages = Post.select().count() / itp return render_template("index.html", posts=posts, page=page, total_pages=total_pages) diff --git a/suchwow/templates/index.html b/suchwow/templates/index.html index 058352a..fcb7325 100644 --- a/suchwow/templates/index.html +++ b/suchwow/templates/index.html @@ -21,7 +21,7 @@ {{ post.timestamp.strftime('%Y-%m-%d %H:%M') }} {{ post.id }} {{ post.title }} - {{ post.submitter }} + {{ post.submitter }} {% endfor %} @@ -32,11 +32,11 @@ {% if page > 1 %} - Back + Back {% endif %} {% if page < total_pages and total_pages > 0 %} - Next + Next {% endif %}
diff --git a/suchwow/templates/leaderboard.html b/suchwow/templates/leaderboard.html index 00ccf54..917f61e 100644 --- a/suchwow/templates/leaderboard.html +++ b/suchwow/templates/leaderboard.html @@ -12,13 +12,13 @@ - + {% for poster, data in posters.items() | sort(attribute='1.amount', reverse=True) %} - - + + {% endfor %} diff --git a/suchwow/templates/post/read.html b/suchwow/templates/post/read.html index a683788..e0540cc 100644 --- a/suchwow/templates/post/read.html +++ b/suchwow/templates/post/read.html @@ -12,7 +12,7 @@

{{ post.title }}

{{ post.text }}

-

Submitted by {{ post.submitter }} at {{ post.timestamp }}

+

Submitted by {{ post.submitter }} at {{ post.timestamp }}



diff --git a/suchwow/templates/post/top.html b/suchwow/templates/post/top.html index ab2fa8e..d3f59df 100644 --- a/suchwow/templates/post/top.html +++ b/suchwow/templates/post/top.html @@ -22,7 +22,7 @@ - + {% endfor %}
SubmitterPostsPost Count Amount
{{ poster }}{% for post in data["posts"] %}{{ post }}{{ "," if not loop.last }}{% endfor %}{{ poster }}{{ data["posts"] | length }} {{ data["amount"] }} WOW
{{ post[1].timestamp.strftime('%Y-%m-%d %H:%M') }} {{ post[1].id }} {{ post[1].title }}{{ post[1].submitter }}{{ post[1].submitter }} {{ post[0] }} WOW