add date to gallery page
This commit is contained in:
parent
8025ce338c
commit
0000cc6540
|
@ -91,7 +91,7 @@ async def gallery(request):
|
||||||
|
|
||||||
async with request.app['pool'].acquire() as conn:
|
async with request.app['pool'].acquire() as conn:
|
||||||
uploads = await conn.fetch(
|
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)
|
user_id)
|
||||||
upload_url = config.upload_url
|
upload_url = config.upload_url
|
||||||
return render_template("gallery.html", request, locals())
|
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)
|
r.headers['content-disposition']).group(1)
|
||||||
else:
|
else:
|
||||||
fname = os.path.basename(url)
|
fname = os.path.basename(url)
|
||||||
|
fname = re.sub('\?.*$', '', fname)
|
||||||
return (fname, temp)
|
return (fname, temp)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,13 @@
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
<table>
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Upload Date</th>
|
||||||
|
<th>Filename</th>
|
||||||
|
</tr>
|
||||||
{% for upload in uploads %}
|
{% for upload in uploads %}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>{{ upload['upload_date'].strftime('%Y-%m-%d') }}</td>
|
||||||
<td><a href="{{ upload_url + upload['filename'] }}">{{ upload['filename'] }}</a></td>
|
<td><a href="{{ upload_url + upload['filename'] }}">{{ upload['filename'] }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user