mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-19 19:09:22 +02:00
Fix redirect
This commit is contained in:
parent
3d21e4912c
commit
1d6c06208d
2 changed files with 9 additions and 9 deletions
|
@ -805,15 +805,13 @@ 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')
|
||||
# Don't redirect to the website page on save if the user is an analyst.
|
||||
# Rather, just redirect back to the same change page.
|
||||
if analyst_perm and not superuser_perm:
|
||||
opts = obj._meta
|
||||
pk_value = obj._get_pk_val()
|
||||
return HttpResponseRedirect(
|
||||
reverse("admin:%s_%s_change" % (opts.app_label, opts.model_name), args=(pk_value,))
|
||||
)
|
||||
# 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)
|
||||
|
||||
|
||||
|
|
|
@ -49,9 +49,11 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
|||
</div>
|
||||
{% elif field.field.name == "alternative_domains" %}
|
||||
<div class="readonly">
|
||||
{% with current_path=request.get_full_path %}
|
||||
{% for alt_domain in original.alternative_domains.all %}
|
||||
<a href="{% url 'admin:registrar_website_change' alt_domain.id %}">{{ alt_domain }}</a>{% if not forloop.last %}, {% endif %}
|
||||
<a href="{% url 'admin:registrar_website_change' alt_domain.id %}?{{ 'return_path='|add:current_path }}">{{ alt_domain }}</a>{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="readonly">{{ field.contents }}</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue