From 3d88dd7979ba200fd6f915e4cda32e79a8c569c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?X=C3=A9fir=20Destiny?= Date: Wed, 11 Dec 2019 21:03:25 +0100 Subject: [PATCH] Fix + JS hack --- app.py | 4 ++-- templates/admin/edit.html | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index 2962a6e..bf25174 100644 --- a/app.py +++ b/app.py @@ -140,7 +140,7 @@ def admin_add(): titles = AnimeTitle.query.all() link = AnimeLink() for attr in dir(link): - if not attr.startswith('_'): + if not attr.startswith('_') and getattr(link, attr) is None: try: setattr(link, attr, '') except: @@ -154,7 +154,7 @@ def admin_add(): def admin_save(): form = EditForm(request.form) if form.validate_on_submit(): - folder = AnimeFolder.query.filter_by(id=form.folder) + folder = AnimeFolder.query.filter_by(id=form.folder).first() title = AnimeTitle.query.filter_by(name=form.name).first() title.folder = folder title.name = form.name diff --git a/templates/admin/edit.html b/templates/admin/edit.html index 0e08acd..afde243 100644 --- a/templates/admin/edit.html +++ b/templates/admin/edit.html @@ -21,11 +21,23 @@ {{ edit_form.name(value=link.title.name, list='animes', class='input', placeholder='Name') }} {% for title in titles %} - + + + @@ -62,9 +74,8 @@ {{ edit_form.keyword(value=link.title.keyword, list='keywords', class='input', placeholder='Keyword') }} {% for title in titles %} - +