Reversed media file sorting and increased shown number

This commit is contained in:
JayPiKay 2019-02-17 09:47:14 +01:00
parent f068221b3f
commit cc6b9d08bc
2 changed files with 3 additions and 2 deletions

View File

@ -72,7 +72,7 @@ def create():
blogstore.create_post(title, body, g.user['username'])
return redirect(url_for('blog.index'))
return render_template('blog/create.html', images=get_images(max_files=4))
return render_template('blog/create.html', images=get_images())
@bp.route('/update/<path:entry>', methods=('GET', 'POST'))

View File

@ -4,13 +4,14 @@ from flask import current_app, g
from flask_uploads import UploadSet, IMAGES, configure_uploads
def get_images(path=None, max_files=8):
def get_images(path=None, max_files=16):
if not path:
path = current_app.config['UPLOADED_IMAGES_DEST']
all_files = []
for root, _, files in os.walk(path):
all_files += files
all_files.reverse()
for filename in sorted(all_files)[:max_files]:
yield f'/upload/get/{filename}'