more manage_users

This commit is contained in:
iou1name 2018-04-15 00:08:18 -04:00
parent 46ade7956f
commit 90f7bf75ed
2 changed files with 20 additions and 4 deletions

View File

@ -3,6 +3,7 @@
Simple file host using Flask. Simple file host using Flask.
""" """
import os import os
import time
import string import string
import secrets import secrets
import sqlite3 import sqlite3
@ -261,9 +262,14 @@ def manage_uploads():
"SELECT filename, uploaded_date FROM uploads WHERE uploaded_by = ?", "SELECT filename, uploaded_date FROM uploads WHERE uploaded_by = ?",
(username,)).fetchall() (username,)).fetchall()
new_uploads = []
for file, date in uploads:
file = app.config.get("UPLOAD_URL") + file
date = time.strftime("%Y-%m-%d %H:%M", date)
new_uploads.append((file, date))
if request.method == "GET": if request.method == "GET":
return render_template("manage_uploads.html", uploads=uploads, return render_template("manage_uploads.html", uploads=new_uploads)
app_url=app.config.get("APP_URL"))
@app.route("/", methods=["POST", "GET"]) @app.route("/", methods=["POST", "GET"])

View File

@ -4,7 +4,17 @@
<title>Manage your uploads</title> <title>Manage your uploads</title>
</head> </head>
<body> <body>
<table>
<tr>
<th>File</th>
<th>Date Uploaded</th>
</tr>
{% for file, date in uploads %} {% for file, date in uploads %}
{% app_url + file + "\t" + date %} <tr>
<td>{{ upload_url + file }}</td>
<td>{{ date|string }}</td>
</tr>
{% endfor %}
</table>
</body> </body>
</html> </html>