mirror of
https://git.ari.lt/ari.lt/ari.lt.git
synced 2025-02-04 09:39:25 +01:00
Add sort by newest option.
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
5e4fd963c3
commit
d47ba255f1
2 changed files with 13 additions and 5 deletions
|
@ -79,13 +79,20 @@ def set_status() -> Response:
|
||||||
def index() -> str:
|
def index() -> str:
|
||||||
"""Home page"""
|
"""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(
|
return flask.render_template(
|
||||||
"index.j2",
|
"index.j2",
|
||||||
visitor=models.Counter.first().inc().count,
|
visitor=models.Counter.first().inc().count,
|
||||||
comments=models.Comment.query.filter_by(confirmed=True).order_by(
|
comments=comments,
|
||||||
models.Comment.score.desc(), # type: ignore
|
|
||||||
models.Comment.posted.desc(), # type: ignore
|
|
||||||
),
|
|
||||||
status=status,
|
status=status,
|
||||||
comment=flask.request.args.get("gb"),
|
comment=flask.request.args.get("gb"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -516,7 +516,8 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<i>Report any impersonation, illegal/graphic content, and/or anything disturbing to the owner of this website: Ari Archer.</i>
|
<p><i>Report any impersonation, illegal/graphic content, and/or anything disturbing to the owner of this website: Ari Archer.</i></p>
|
||||||
|
<p><a href="/#gb">Sort by score</a> | <a href="/?newest#gb">Sort by newest</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="comments">
|
<div id="comments">
|
||||||
|
|
Loading…
Add table
Reference in a new issue