Skip to content

Instantly share code, notes, and snippets.

@vero4karu vero4karu/admin.py
Last active Jul 19, 2019

Embed
What would you like to do?
Django: how to remove delete action/button from admin
class MyAdmin(admin.ModelAdmin):
def has_delete_permission(self, request, obj=None):
return False
def get_actions(self, request):
actions = super(MyAdmin, self).get_actions(request)
if 'delete_selected' in actions:
del actions['delete_selected']
return actions
@Allan-Nava

This comment has been minimized.

Copy link

Allan-Nava commented Mar 27, 2018

it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.