Skip to content

Commit

Permalink
fix: Improved redirect handling in success message action
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Jan 8, 2025
1 parent 3bd0066 commit f7e2413
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion djangocms_form_builder/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,15 @@ class Meta:
)

def execute(self, form, request):
from .cms_plugins.ajax_plugins import SAME_PAGE_REDIRECT

message = self.get_parameter(form, "submitmessage_message")
# Overwrite the success context and render template
form.get_success_context = lambda *args, **kwargs: {"message": message}
form.Meta.options["render_success"] = "djangocms_form_builder/actions/submit_message.html"
form.Meta.options["redirect"] = None
# Overwrite the default redirect to same page
if form.Meta.options.get("redirect") == SAME_PAGE_REDIRECT:
form.Meta.options["redirect"] = None


if apps.is_installed("djangocms_link"):
Expand Down

0 comments on commit f7e2413

Please sign in to comment.