Skip to content

Commit

Permalink
fix: an error when an anonymous user fills the form (#13)
Browse files Browse the repository at this point in the history
* 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

* Update djangocms_form_builder/actions.py

Cleaner way of checking for anonymous user

Co-authored-by: Fabian Braun <[email protected]>

---------

Co-authored-by: Fabian Braun <[email protected]>
  • Loading branch information
arunk and fsbraun authored Aug 25, 2024
1 parent 20d0f69 commit 8abab17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion djangocms_form_builder/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def execute(self, form, request):
keys = {}
defaults = {
"form_name": get_option(form, "form_name"),
"form_user": request.user,
"form_user": None if request.user.is_anonymous else request.user
}
defaults.update(
{
Expand Down

0 comments on commit 8abab17

Please sign in to comment.