~petersanchez/django-impersonate#42: 
Disable the "Add impersonation log" button

Since all of the ImpersonationLog model's fields are in the ImpersonationLogAdmin class' readonly_fields, there is no need for the "Add impersonation log" button. I propose that you add this to the ImpersonationLogAdmin class:

def has_add_permission(self, request):
    return False

I could make a pull request of this if you're interested.

Status
RESOLVED IMPLEMENTED
Submitter
bitbucket:Adam Taylor
Assigned to
No-one
Submitted
7 years ago
Updated
3 years ago
Labels
1.6

bitbucket:Peter Sanchez 7 years ago · edit

No Message

bitbucket:Peter Sanchez 7 years ago · edit

Thanks. This is definitely a good idea

bitbucket:Jay Park 4 years ago · edit

How about making read-only?

actions = None

def has_add_permission(self, request):
    return False

def has_delete_permission(self, request, obj=None):
    return False

# hack to show records but limit updating.
# `return False` hides impersonates module in admin page
def has_change_permission(self, request, obj=None):
    return request.method in ['GET', 'HEAD']

~petersanchez 3 years ago

This is probably related to #41 as well.

Register here or Log in to comment, or comment via email.