From 1d8abd8f4b0f0249394ce3daedb84cbbfab56553 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 10 Jul 2020 22:19:47 +0100 Subject: [PATCH] Fix screenshot approval checkbox always being unchecked Fixes #212 --- app/blueprints/packages/releases.py | 2 +- app/blueprints/packages/screenshots.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/blueprints/packages/releases.py b/app/blueprints/packages/releases.py index 44987380..f06f055f 100644 --- a/app/blueprints/packages/releases.py +++ b/app/blueprints/packages/releases.py @@ -167,8 +167,8 @@ def edit_release(package, id): # Initial form class from post data and default data form = EditPackageReleaseForm(formdata=request.form, obj=release) - # HACK: fix bug in wtforms if request.method == "GET": + # HACK: fix bug in wtforms form.approved.data = release.approved if request.method == "POST" and form.validate(): diff --git a/app/blueprints/packages/screenshots.py b/app/blueprints/packages/screenshots.py index 68a3075a..12144ea9 100644 --- a/app/blueprints/packages/screenshots.py +++ b/app/blueprints/packages/screenshots.py @@ -85,6 +85,11 @@ def edit_screenshot(package, id): # Initial form class from post data and default data form = EditScreenshotForm(formdata=request.form, obj=screenshot) + + if request.method == "GET": + # HACK: fix bug in wtforms + form.approved.data = screenshot.approved + if request.method == "POST" and form.validate(): if canEdit and form["delete"].data: PackageScreenshot.query.filter_by(id=id).delete()