Fix issues

This commit is contained in:
Patrick Jentsch 2022-11-18 16:02:24 +01:00
parent 3e9d749574
commit a822a2e3a0
2 changed files with 13 additions and 13 deletions

View File

@ -48,10 +48,12 @@ def user(user_id):
def edit_user(user_id): def edit_user(user_id):
user = User.query.get_or_404(user_id) user = User.query.get_or_404(user_id)
admin_edit_user_form = AdminEditUserForm( admin_edit_user_form = AdminEditUserForm(
obj=user,
prefix='admin-edit-user-form' prefix='admin-edit-user-form'
) )
edit_general_settings_form = EditGeneralSettingsForm( edit_general_settings_form = EditGeneralSettingsForm(
user, user,
obj=user,
prefix='edit-general-settings-form' prefix='edit-general-settings-form'
) )
edit_notification_settings_form = EditNotificationSettingsForm( edit_notification_settings_form = EditNotificationSettingsForm(
@ -81,8 +83,6 @@ def edit_user(user_id):
db.session.commit() db.session.commit()
flash('Your changes have been saved') flash('Your changes have been saved')
return redirect(url_for('.edit_user', user_id=user.id)) 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) edit_notification_settings_form.prefill(user)
return render_template( return render_template(
'admin/edit_user.html.j2', 'admin/edit_user.html.j2',

View File

@ -432,7 +432,7 @@ class Utils {
fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}}) fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}})
.then( .then(
(response) => { (response) => {
app.flash(msg, 'corpus'); app.flash(msg);
resolve(response); resolve(response);
}, },
(response) => { (response) => {
@ -453,16 +453,16 @@ class Utils {
msg = `Model "${spaCyNLPPipelineModel.title}" is now private`; msg = `Model "${spaCyNLPPipelineModel.title}" is now private`;
} }
fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}}) fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}})
.then( .then(
(response) => { (response) => {
app.flash(msg, 'corpus'); app.flash(msg);
resolve(response); resolve(response);
}, },
(response) => { (response) => {
if (response.status === 403) {app.flash('Forbidden', 'error');} if (response.status === 403) {app.flash('Forbidden', 'error');}
reject(response); reject(response);
} }
); );
}); });
} }
} }