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'] }}