From 01c4940ad08c5e8641c6e2b0b7cfd61e1436cc64 Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Mon, 29 Jul 2024 15:42:19 -0400 Subject: [PATCH] add error message --- jwql/website/apps/jwql/data_containers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jwql/website/apps/jwql/data_containers.py b/jwql/website/apps/jwql/data_containers.py index 83ce55ed6..a61a43804 100644 --- a/jwql/website/apps/jwql/data_containers.py +++ b/jwql/website/apps/jwql/data_containers.py @@ -721,6 +721,8 @@ def get_comment_form(request, file_root): comment_form = RootFileInfoCommentSubmitForm(request.POST, instance=root_file_info) if comment_form.is_valid(): comment_form.save() + else: + messages.error(request, "Failed to update comment form") else: comment_form = RootFileInfoCommentSubmitForm(instance=root_file_info) @@ -757,7 +759,7 @@ def get_exp_comment_form(request, file_root): rootfileinfo.exp_comment = exp_comment_form.cleaned_data['exp_comment'] rootfileinfo.save() else: - raise forms.ValidationError("Invalid content!") + messages.error(request, "Failed to update exposure comment form") else: exp_comment_form = RootFileInfoExposureCommentSubmitForm(instance=rootfileinfo_set.first())