This is in reference to an issue with the Django admin site in Django v2.2.
I have admin set up for two models: Group and GroupMember.
GroupMember works fine.
When I try to go to the change page for a Group object in my
staff admin area I get a permission error:
*You are authenticated as XXXXXXXXXX, but are not authorized to access this
page. Would you like to login to a different account?*
I have two admin sites, site_admin and staff_admin which I use to
differentiate between control capabilities for the superuser and for those
accounts that have a is_staff attribute set to True. All other staff_admin
areas work fine.
Admin Site definitions:
class SiteAdminSite(AdminSite):
def has_permission(self, request):
return request.user.is_superuser and request.user.is_active
class StaffAdminSite(AdminSite):
def has_permission(self, request):
return request.user.is_staff and request.user.is_active
staff_admin = StaffAdminSite(name='staff')
site_admin = SiteAdminSite(name='admin')
I have an app, member, that has the two classes pertinent to this issue:
class Group(BaseModelUUID):
class Meta:
db_table = 'group'
...
class GroupMember(BaseModelUUID):
class Meta:
db_table = 'group_member'
...
I define admin areas for these models in admin.py:
from app.member.models import (
...
Group,
GroupMember,
...
)
...
@admin.register(Group)
class GroupAdmin(DjangoQLMixin,BaseModelAdmin):
...
@admin.register(GroupMember)
class GroupMemberAdmin(DjangoQLMixin,BaseModelAdmin):
...
staff_admin.register(Group,GroupAdmin)
staff_admin.register(GroupMember,GroupMemberAdmin)
...
site_admin.register(Group,GroupAdmin)
site_admin.register(GroupMember,GroupMemberAdmin)
...
I've trimmed a lot of stuff but that is because it is
exactly the same between the two models.
What could be causing this one model admin to have a permissions issue?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/f2630a68-93c5-4650-89bc-113540b72fb8n%40googlegroups.com.