Fix add choices

This commit is contained in:
Michel Roux 2019-12-13 19:22:45 +01:00
parent 1d06a9507c
commit 31bae530df

1
app.py
View File

@ -153,6 +153,7 @@ def admin_add():
@auth.login_required @auth.login_required
def admin_save(): def admin_save():
form = EditForm(request.form) form = EditForm(request.form)
form.folder.choices = [(query.id, query.name) for query in AnimeFolder.query.all()]
if form.validate_on_submit(): if form.validate_on_submit():
title = AnimeTitle.query.filter_by(name=form.name.data).first() title = AnimeTitle.query.filter_by(name=form.name.data).first()
title = title if title else AnimeTitle() title = title if title else AnimeTitle()