|
|
|
@ -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)
|
|
|
|
|
|
|
|
|
|