Reversed media file sorting and increased shown number
This commit is contained in:
parent
f068221b3f
commit
cc6b9d08bc
|
@ -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'))
|
||||
|
|
|
@ -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}'
|
||||
|
||||
|
|
Loading…
Reference in New Issue