django-adminplus
django-adminplus copied to clipboard
Moving to adminplus locks out superuser from editing
When I add SimpleAdminConfig in settings.py, and set admin.site to a new AdminSitePlus in urls.py, I get the message "You don’t have permission to view or edit anything." when logged in as a superuser.
If I revert those two edits, switching back to the standard admin, I can see and edit as usual.
Happy to help debug but not sure where to start.
Aha. This happens if you don't explicitly call admin.autodiscover(). I thought it wasn't necessary since I had stuff in admin.py. I only see the tables for my app and not the auth tables, but I suspect this is related.
And the problem is if you use the @admin.register decorator rather than admin.site.register(). According to https://docs.djangoproject.com/en/4.2/ref/contrib/admin/#the-register-decorator, the call to the decorator needs to also point to the new Admin site.
Now, if you use any other package, and it uses the @admin.register decorator, it won't know about adminplus. For example, contrib.auth. And so, nothing in admin.
This sounds like a bug so I won't close this out. I can't decide if it's a Django bug or an adminplus bug.