Django admin stickied navigation menu issues

Hi!

I recently upgraded to 3.1 and have run into some issue with how admin is displayed. I see a PR related to the new admin nav which seems to be related. When I go to the app level, the list view renders as normal but when I go to a model detail or a model change view, the menu is the full width and height of the screen. The toggle button doesn’t seem to work either, I just end up inspecting and deleting the navigation element. See below for a screenshot.

Using Windows 10 → chrome 84.0.4147.125 (Official Build) (64-bit) on a 23 inch monitor

I am not seeing anything like this in my version. I suggest you try clearing the cache and doing a “hard refresh” (shift-refresh / shift F5) - or, trying this in an incognito window.

If you’re still having this issue after trying this, please let us know.

Ken

1 Like

Hey Ken,

You’re right, I must’ve had a cached version. Looks great, hats off too knyghty and the whole team!

Hi. I can confirm that this is still an issue. I don’t think its cache-related either. Cleared cache, used incognito mode and I am developing in a Docker environment where every build re-collects static files. Even tried re-installing Django but still not working as intended (See screenshot)

Can you produce a minimum sample that presents this behavior? Perhaps one app / model / ModelAdmin class? It might also help if you posted the results of a pip freeze, and the output from your console where you’re running runserver when accessing this page. (I have never seen this happen outside the context of a dirty browser cache.)

1 Like

Hi! I have same issue with the new django admin sidebar using all screen and displaying data below instead than at the middle. The issue was present only in my production version and it worked fine in development with Debug=True in settings.py. Clearing the cache or Force Refresh with Ctrl + F5 did not fix the issue. Running manage.py collectstatic did not fix the issue either. After disabling Cache in the browser with Ctrl + Shift + i, selecting Network tab and tick Disable Cache I discovered a 404 in nav_sidebar.css and nav_sidebar.js. The problem were the the static files. I had different path for the static folder in settings.py and httpd.conf (using Apache). Using same path in both files and running collectstatic followed by a Ctrl + F5 to refresh the admin page fixed the issue.

Hi! I found out the same problem in a Django4.0 project.
The solution was to change the order in the Installed Apps. Probably there is something that override options and / or files related to the navigation bar in the admin page.

My suggestion is to try to set ‘django.contrib.admin’ as first in the INSTALLED_APPS.

For me the problem went away when I commented out theses lines:

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "staticfiles"),
]