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 @@
Submitter | -Posts | +Post 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 | {% endfor %}