I've added the django auditlog to my project. I've different user groups with is_staff=True. I want to allow some users to only view LogEntries table and detail page (view_logentry permission). when I add permission view_logentry to my Group it shows this error:
CommandError: Unable to load data: get() returned more than one Permission -- it returned 2!
It's because there are multiple permission for the same LogEntry model, check the image below:
To properly add the permissions I'm using this approach:
for permission in Permission.objects.filter(codename='view_logentry'):
if permission.natural_key()[1] == 'auditlog':
group.permissions.add(permission)
But I still want to know if there is an issue with my implementation or this result is expected duplicate permission codename)
Thanks!
TheAdministration | log entry| ... is for django admin app LogEntry model which is a different model than auditlog.LogEntry. I added both view permissions from both apps and it works.
I've added the django auditlog to my project. I've different user groups with
is_staff=True
. I want to allow some users to only viewLogEntries
table and detail page (view_logentry permission). when I add permissionview_logentry
to myGroup
it shows this error:It's because there are multiple permission for the same
LogEntry
model, check the image below:To properly add the permissions I'm using this approach:
But I still want to know if there is an issue with my implementation or this result is expected duplicate permission codename) Thanks!