Fix add link
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-09-29 13:26:59 +02:00
parent 511d7b9be0
commit 4feb120366

View File

@ -155,6 +155,7 @@ def admin_edit(link_id=None):
folder = folder if folder else AnimeFolder() folder = folder if folder else AnimeFolder()
folder.name = form.folder.data folder.name = form.folder.data
db.session.add(folder) db.session.add(folder)
db.session.commit()
# Title # Title
link = AnimeLink.query.filter_by(id=form.id.data).first() link = AnimeLink.query.filter_by(id=form.id.data).first()
link = link if link else AnimeLink() link = link if link else AnimeLink()
@ -165,6 +166,7 @@ def admin_edit(link_id=None):
title.name = form.name.data title.name = form.name.data
title.keyword = form.keyword.data.lower() if form.keyword.data else title.keyword title.keyword = form.keyword.data.lower() if form.keyword.data else title.keyword
db.session.add(title) db.session.add(title)
db.session.commit()
# Link # Link
link.title_id = title.id link.title_id = title.id
link.link = form.link.data link.link = form.link.data
@ -173,6 +175,7 @@ def admin_edit(link_id=None):
link.vf = form.is_vf.data link.vf = form.is_vf.data
db.session.add(link) db.session.add(link)
db.session.commit() db.session.commit()
remove_garbage(link)
return redirect(url_for('admin')) return redirect(url_for('admin'))
if link_id: if link_id: