mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-24 19:48:36 +02:00
Merge branch 'main' into za/1001-update-to-use-sentence-case
This commit is contained in:
commit
6dc280dd08
4 changed files with 56 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
from django import forms
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import redirect
|
||||
from django_fsm import get_available_FIELD_transitions
|
||||
from django.contrib import admin, messages
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
|
@ -360,6 +361,17 @@ class UserDomainRoleAdmin(ListHeaderAdmin):
|
|||
|
||||
autocomplete_fields = ["user", "domain"]
|
||||
|
||||
# Fixes a bug where non-superusers are redirected to the main page
|
||||
def delete_view(self, request, object_id, extra_context=None):
|
||||
"""Custom delete_view implementation that specifies redirect behaviour"""
|
||||
response = super().delete_view(request, object_id, extra_context)
|
||||
|
||||
if isinstance(response, HttpResponseRedirect) and not request.user.has_perm("registrar.full_access_permission"):
|
||||
url = reverse("admin:registrar_userdomainrole_changelist")
|
||||
return redirect(url)
|
||||
else:
|
||||
return response
|
||||
|
||||
|
||||
class DomainInvitationAdmin(ListHeaderAdmin):
|
||||
"""Custom domain invitation admin class."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue