fix: save before loading list
Also drop print. This updates the uploaded list correctly.
This commit is contained in:
parent
de85c36510
commit
17bf2fa74f
10
upload.py
10
upload.py
@ -39,6 +39,11 @@ def saveimage(image):
|
|||||||
def index():
|
def index():
|
||||||
"""Upload route, a page to upload an image"""
|
"""Upload route, a page to upload an image"""
|
||||||
imageuploadform = ImageUploadForm()
|
imageuploadform = ImageUploadForm()
|
||||||
|
|
||||||
|
if request.method == "POST":
|
||||||
|
if imageuploadform.validate_on_submit():
|
||||||
|
saveimage(imageuploadform.image.data)
|
||||||
|
|
||||||
uploaded_files = sorted(
|
uploaded_files = sorted(
|
||||||
[
|
[
|
||||||
os.path.join(APP.config["IMAGE_FOLDER"], file)
|
os.path.join(APP.config["IMAGE_FOLDER"], file)
|
||||||
@ -46,10 +51,7 @@ def index():
|
|||||||
],
|
],
|
||||||
key=os.path.getctime,
|
key=os.path.getctime,
|
||||||
)
|
)
|
||||||
print(uploaded_files)
|
|
||||||
if request.method == "POST":
|
|
||||||
if imageuploadform.validate_on_submit():
|
|
||||||
saveimage(imageuploadform.image.data)
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"upload.html",
|
"upload.html",
|
||||||
imageuploadform=imageuploadform,
|
imageuploadform=imageuploadform,
|
||||||
|
Loading…
Reference in New Issue
Block a user