Propagate success message

This commit is contained in:
zandercymatics 2024-04-12 08:39:04 -06:00
parent 61b71c298e
commit 53d5c3bd61
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -805,14 +805,19 @@ class WebsiteAdmin(ListHeaderAdmin):
"""
superuser_perm = request.user.has_perm("registrar.full_access_permission")
analyst_perm = request.user.has_perm("registrar.analyst_access_permission")
return_path = request.GET.get('return_path')
return_path = request.GET.get("return_path")
# First, call the super method to perform the standard operations and capture the response
response = super().response_change(request, obj)
# Don't redirect to the website page on save if the user is an analyst.
# Rather, just redirect back to the originating page.
if (analyst_perm and not superuser_perm) and return_path:
# Redirect to the return path if it exists
return HttpResponseRedirect(return_path)
return super().response_change(request, obj)
# If no redirection is needed, return the original response
return response
class UserDomainRoleAdmin(ListHeaderAdmin):
@ -1960,14 +1965,19 @@ class DraftDomainAdmin(ListHeaderAdmin):
"""
superuser_perm = request.user.has_perm("registrar.full_access_permission")
analyst_perm = request.user.has_perm("registrar.analyst_access_permission")
return_path = request.GET.get('return_path')
return_path = request.GET.get("return_path")
# First, call the super method to perform the standard operations and capture the response
response = super().response_change(request, obj)
# Don't redirect to the website page on save if the user is an analyst.
# Rather, just redirect back to the originating page.
if (analyst_perm and not superuser_perm) and return_path:
# Redirect to the return path if it exists
return HttpResponseRedirect(return_path)
return super().response_change(request, obj)
# If no redirection is needed, return the original response
return response
class PublicContactAdmin(ListHeaderAdmin):