From 3d1837e3c892a808ea5b548a47cae712bec85f10 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 15 Aug 2020 09:39:45 +0200 Subject: [PATCH] =?UTF-8?q?Test=20de=20renommage=20de=20s=C3=A9rie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynyaata/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pynyaata/__init__.py b/pynyaata/__init__.py index e6742da..2849868 100644 --- a/pynyaata/__init__.py +++ b/pynyaata/__init__.py @@ -146,18 +146,21 @@ def admin_edit(link_id=None): form = EditForm(request.form) if form.validate_on_submit(): + # Folder folder = AnimeFolder.query.filter_by(name=form.folder.data).first() folder = folder if folder else AnimeFolder() folder.name = form.folder.data db.session.add(folder) - title = AnimeTitle.query.filter_by(name=form.name.data).first() + # Title + link = AnimeLink.query.filter_by(id=form.id.data).first() + link = link if link else AnimeLink() + title = AnimeTitle.query.filter_by(id=link.title_id).first() title = title if title else AnimeTitle() title.folder_id = folder.id title.name = form.name.data title.keyword = form.keyword.data.lower() if form.keyword.data else title.keyword db.session.add(title) - link = AnimeLink.query.filter_by(id=form.id.data).first() - link = link if link else AnimeLink() + # Link link.title_id = title.id link.link = form.link.data link.season = form.season.data