diff --git a/app/blueprints/admin/admin.py b/app/blueprints/admin/admin.py index cd4232e7..a8539022 100644 --- a/app/blueprints/admin/admin.py +++ b/app/blueprints/admin/admin.py @@ -53,7 +53,7 @@ class SwitchUserForm(FlaskForm): def switch_user(): form = SwitchUserForm(formdata=request.form) if form.validate_on_submit(): - user = User.query.filter_by(username=form["username"].data).first() + user = User.query.filter_by(username=form.username.data).first() if user is None: flash("Unable to find user", "danger") elif login_user(user): diff --git a/app/blueprints/packages/releases.py b/app/blueprints/packages/releases.py index 4d613783..9eddd11f 100644 --- a/app/blueprints/packages/releases.py +++ b/app/blueprints/packages/releases.py @@ -68,7 +68,7 @@ class CreatePackageReleaseForm(FlaskForm): class EditPackageReleaseForm(FlaskForm): name = StringField(lazy_gettext("Name"), [InputRequired(), Length(1, 30)]) - title = StringField(lazy_gettext("Title"), [Optional(), Length(1, 30)], filters=[nonempty_or_none]) + title = StringField(lazy_gettext("Title"), [InputRequired(), Length(1, 30)], filters=[nonempty_or_none]) release_notes = TextAreaField(lazy_gettext("Release Notes"), [Optional(), Length(1, 100)], filters=[nonempty_or_none, normalize_line_endings]) url = StringField(lazy_gettext("URL"), [Optional()]) @@ -178,13 +178,15 @@ def edit_release(package, id): if form.validate_on_submit(): if canEdit: - release.title = form["title"].data - release.min_rel = form["min_rel"].data.get_actual() - release.max_rel = form["max_rel"].data.get_actual() + release.name = form.name.data + release.title = form.title.data + release.release_notes = form.release_notes.data + release.min_rel = form.min_rel.data.get_actual() + release.max_rel = form.max_rel.data.get_actual() if package.check_perm(current_user, Permission.CHANGE_RELEASE_URL): - release.url = form["url"].data - release.task_id = form["task_id"].data + release.url = form.url.data + release.task_id = form.task_id.data if release.task_id is not None: release.task_id = None @@ -227,10 +229,10 @@ def bulk_change_release(package): only_change_none = form.only_change_none.data for release in package.releases.all(): - if form["set_min"].data and (not only_change_none or release.min_rel is None): - release.min_rel = form["min_rel"].data.get_actual() - if form["set_max"].data and (not only_change_none or release.max_rel is None): - release.max_rel = form["max_rel"].data.get_actual() + if form.set_min.data and (not only_change_none or release.min_rel is None): + release.min_rel = form.min_rel.data.get_actual() + if form.set_max.data and (not only_change_none or release.max_rel is None): + release.max_rel = form.max_rel.data.get_actual() db.session.commit() diff --git a/app/blueprints/packages/screenshots.py b/app/blueprints/packages/screenshots.py index 06878b81..5af04cd6 100644 --- a/app/blueprints/packages/screenshots.py +++ b/app/blueprints/packages/screenshots.py @@ -112,10 +112,10 @@ def edit_screenshot(package, id): was_approved = screenshot.approved if can_edit: - screenshot.title = form["title"].data or "Untitled" + screenshot.title = form.title.data or "Untitled" if can_approve: - screenshot.approved = form["approved"].data + screenshot.approved = form.approved.data else: screenshot.approved = was_approved diff --git a/app/blueprints/users/settings.py b/app/blueprints/users/settings.py index 471e4213..870ec1d2 100644 --- a/app/blueprints/users/settings.py +++ b/app/blueprints/users/settings.py @@ -370,10 +370,10 @@ def modtools(username): redirect_target = url_for("tasks.check", id=task_id, r=redirect_target) if user.check_perm(current_user, Permission.CHANGE_RANK): - new_rank = form["rank"].data + new_rank = form.rank.data if current_user.rank.at_least(new_rank): if new_rank != user.rank: - user.rank = form["rank"].data + user.rank = form.rank.data msg = "Set rank of {} to {}".format(user.display_name, user.rank.title) add_audit_log(AuditSeverity.MODERATION, current_user, msg, url_for("users.profile", username=username)) diff --git a/app/templates/packages/release_new.html b/app/templates/packages/release_new.html index 6ac0ad7c..ab275ef7 100644 --- a/app/templates/packages/release_new.html +++ b/app/templates/packages/release_new.html @@ -40,7 +40,7 @@