diff --git a/app/admin/routes.py b/app/admin/routes.py index 38ad9253..8f4370fd 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -48,10 +48,12 @@ def user(user_id): def edit_user(user_id): user = User.query.get_or_404(user_id) admin_edit_user_form = AdminEditUserForm( + obj=user, prefix='admin-edit-user-form' ) edit_general_settings_form = EditGeneralSettingsForm( user, + obj=user, prefix='edit-general-settings-form' ) edit_notification_settings_form = EditNotificationSettingsForm( @@ -81,8 +83,6 @@ def edit_user(user_id): db.session.commit() flash('Your changes have been saved') return redirect(url_for('.edit_user', user_id=user.id)) - admin_edit_user_form.prefill(user) - edit_general_settings_form.prefill(user) edit_notification_settings_form.prefill(user) return render_template( 'admin/edit_user.html.j2', diff --git a/app/static/js/Utils.js b/app/static/js/Utils.js index 31c89087..01de8207 100644 --- a/app/static/js/Utils.js +++ b/app/static/js/Utils.js @@ -432,7 +432,7 @@ class Utils { fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}}) .then( (response) => { - app.flash(msg, 'corpus'); + app.flash(msg); resolve(response); }, (response) => { @@ -453,16 +453,16 @@ class Utils { msg = `Model "${spaCyNLPPipelineModel.title}" is now private`; } fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}}) - .then( - (response) => { - app.flash(msg, 'corpus'); - resolve(response); - }, - (response) => { - if (response.status === 403) {app.flash('Forbidden', 'error');} - reject(response); - } - ); + .then( + (response) => { + app.flash(msg); + resolve(response); + }, + (response) => { + if (response.status === 403) {app.flash('Forbidden', 'error');} + reject(response); + } + ); }); } }