From a5f3eab0544adb4f534b259520448aafefff786b Mon Sep 17 00:00:00 2001 From: Arun Kumar Date: Sun, 25 Aug 2024 22:47:52 +0530 Subject: [PATCH] Fix an error when an anonymous user fills the form SaveDBAction.execute method uses request.user for form_user but request.user is not an instance of User for AnonymousUsers therefore we need to check for whether the user is logged in or not --- djangocms_form_builder/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangocms_form_builder/actions.py b/djangocms_form_builder/actions.py index dc01b27..c05c6c5 100644 --- a/djangocms_form_builder/actions.py +++ b/djangocms_form_builder/actions.py @@ -119,7 +119,7 @@ def execute(self, form, request): keys = {} defaults = { "form_name": get_option(form, "form_name"), - "form_user": request.user, + "form_user": request.user if get_option(form, "login_required", False) else None } defaults.update( {