Skip to content

Commit 5338e69

Browse files
devGregAclaude
andcommitted
fix(profile): redirect after successful POST so UI toggle takes effect
view_profile rendered the response inline after saving the form, which meant UIPreferenceLoader and the beta-banner context processor ran against the same request that just toggled ui_use_tailwind. The result showed the previous UI on the success page; only the next request reflected the change. Switch to Post-Redirect-Get so the success page renders against a fresh request. Also prevents form resubmission on refresh. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a51b5d0 commit 5338e69

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

dojo/user/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ def view_profile(request):
255255
messages.SUCCESS,
256256
_("Profile updated successfully."),
257257
extra_tags="alert-success")
258+
# Redirect so the response renders against a fresh request — this
259+
# ensures UIPreferenceLoader and the UI-toggle banner read the
260+
# just-saved usercontactinfo (e.g. ui_use_tailwind) instead of any
261+
# state cached on the POST request. Also prevents form
262+
# resubmission on refresh.
263+
return HttpResponseRedirect(reverse("view_profile"))
258264
add_breadcrumb(title=_("User Profile - %(user_full_name)s") % {"user_full_name": user.get_full_name()}, top_level=True, request=request)
259265
return render(request, "dojo/profile.html", {
260266
"user": user,

0 commit comments

Comments
 (0)