django-polymorphic
django-polymorphic copied to clipboard
Django polymorphic breaks admin site in setups with SCRIPT_NAME
The function get_model_perms in admin/childadmin.py can't resolve a match for the /admin/ path in setups where the wsgi parameter SCRIPT_NAME is set, because request.path seems to be prepended with the SCRIPT_NAME. An error 404 is returned instead of the admin homepage.
In my setup, using request.path_info instead works for me.
I had the same issue. Worked fine on my local but when I deployed to staging I hit this issue. My site is set up to run in a non-root path. I was getting a 404 error after logging into the admin interface. Changing match = resolve(request.path) to match = resolve(request.path_info) in get_model_perms() in childadmin.py made the error go away.