class CustomModelAdmin ModelAdmin forbid_deleting False def has_delete

1
2
3
4
5
6
7
8
9
class CustomModelAdmin(ModelAdmin):
forbid_deleting = False
def has_delete_permission(self, request, obj=None):
if forbid_deleting:
return False
return super(CustomModelAdmin, self).has_delete_permission(request, obj)