Implement owner delete in admin
This commit is contained in:
parent
20e2d0a321
commit
e3d5c45eb0
1 changed files with 5 additions and 0 deletions
|
@ -22,6 +22,11 @@ class RedirectAdmin(admin.ModelAdmin):
|
|||
codename = get_permission_codename("change", opts)
|
||||
return request.user.has_perm(f"{opts.app_label}.{codename}", obj)
|
||||
|
||||
def has_delete_permission(self, request: HttpRequest, obj: Redirect = None):
|
||||
opts = self.opts
|
||||
codename = get_permission_codename("delete", opts)
|
||||
return request.user.has_perm(f"{opts.app_label}.{codename}", obj)
|
||||
|
||||
def has_view_permission(self, request: HttpRequest, obj: Redirect = None):
|
||||
opts = self.opts
|
||||
codename = get_permission_codename("view", opts)
|
||||
|
|
Loading…
Reference in a new issue