Pass current value to form constructor

This is the more idiomatic way to achieve this in WTForms.
This commit is contained in:
Chris Hill-Scott
2022-01-11 14:17:55 +00:00
parent d4ec4bf9f4
commit 45e178036a

View File

@@ -323,10 +323,7 @@ def organisation_settings(org_id):
@main.route("/organisations/<uuid:org_id>/settings/edit-name", methods=['GET', 'POST'])
@user_is_platform_admin
def edit_organisation_name(org_id):
form = RenameOrganisationForm()
if request.method == 'GET':
form.name.data = current_organisation.name
form = RenameOrganisationForm(name=current_organisation.name)
if form.validate_on_submit():