diff --git a/src/aw/views.py b/src/aw/views.py index 0c31814..6d036dc 100644 --- a/src/aw/views.py +++ b/src/aw/views.py @@ -79,13 +79,20 @@ def set_status() -> Response: def index() -> str: """Home page""" + if "newest" in flask.request.args: + comments = models.Comment.query.filter_by(confirmed=True).order_by( + models.Comment.posted.desc(), # type: ignore + ) + else: + comments = models.Comment.query.filter_by(confirmed=True).order_by( + models.Comment.score.desc(), # type: ignore + models.Comment.posted.desc(), # type: ignore + ) + return flask.render_template( "index.j2", visitor=models.Counter.first().inc().count, - comments=models.Comment.query.filter_by(confirmed=True).order_by( - models.Comment.score.desc(), # type: ignore - models.Comment.posted.desc(), # type: ignore - ), + comments=comments, status=status, comment=flask.request.args.get("gb"), ) diff --git a/src/templates/index.j2 b/src/templates/index.j2 index 2aeae73..e17b138 100644 --- a/src/templates/index.j2 +++ b/src/templates/index.j2 @@ -516,7 +516,8 @@
Report any impersonation, illegal/graphic content, and/or anything disturbing to the owner of this website: Ari Archer.
+