Fix reset order on delete
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-09-29 13:35:19 +02:00
parent 4feb120366
commit 07a69f24fb

View File

@ -121,11 +121,6 @@ def remove_garbage(link):
@mysql_required @mysql_required
@auth.login_required @auth.login_required
def admin(): def admin():
folders = AnimeFolder.query.all()
for folder in folders:
for title in folder.titles:
title.links.sort(key=attrgetter('season'))
folder.titles.sort(key=attrgetter('name'))
form = DeleteForm(request.form) form = DeleteForm(request.form)
if form.validate_on_submit(): if form.validate_on_submit():
@ -138,6 +133,12 @@ def admin():
else: else:
form._errors = {'id': ['Id %s was not found in the database' % form.id.data]} form._errors = {'id': ['Id %s was not found in the database' % form.id.data]}
folders = AnimeFolder.query.all()
for folder in folders:
for title in folder.titles:
title.links.sort(key=attrgetter('season'))
folder.titles.sort(key=attrgetter('name'))
return render_template('admin/list.html', search_form=SearchForm(), folders=folders, action_form=form) return render_template('admin/list.html', search_form=SearchForm(), folders=folders, action_form=form)