From 0000cc6540c539d66d8d4074ffa9bafff774c389 Mon Sep 17 00:00:00 2001 From: iou1name Date: Sat, 15 Apr 2023 18:52:45 -0400 Subject: [PATCH] add date to gallery page --- saddle.py | 3 ++- templates/gallery.html | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/saddle.py b/saddle.py index d81e9c7..c3d93e8 100644 --- a/saddle.py +++ b/saddle.py @@ -91,7 +91,7 @@ async def gallery(request): async with request.app['pool'].acquire() as conn: uploads = await conn.fetch( - "SELECT * FROM upload WHERE user_id = $1", + "SELECT * FROM upload WHERE user_id = $1 ORDER BY upload_date DESC", user_id) upload_url = config.upload_url return render_template("gallery.html", request, locals()) @@ -201,6 +201,7 @@ def download_file(url, timeout=10, max_file_size=config.client_max_size): r.headers['content-disposition']).group(1) else: fname = os.path.basename(url) + fname = re.sub('\?.*$', '', fname) return (fname, temp) diff --git a/templates/gallery.html b/templates/gallery.html index 6cb093b..ef0cbee 100644 --- a/templates/gallery.html +++ b/templates/gallery.html @@ -13,8 +13,13 @@
+ + + + {% for upload in uploads %} + {% endfor %}
Upload DateFilename
{{ upload['upload_date'].strftime('%Y-%m-%d') }} {{ upload['filename'] }}