Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModelAdmin Group and Settings link not working #5492

Closed
josephkohlmaier opened this issue Aug 8, 2019 · 10 comments
Closed

ModelAdmin Group and Settings link not working #5492

josephkohlmaier opened this issue Aug 8, 2019 · 10 comments

Comments

@josephkohlmaier
Copy link

Since upgrading to 2.6.1, the ModelAdminGroup and Settings links in the sidebar do not produce a submenu on click. See video here: https://www.dropbox.com/s/dvmwhipyb85hxjd/issue_submenu.mov?dl=0 – the event defaults as can be seen (# appearing in URL on click)

Python 2.7.12
Django>=2.1,<2.2
All browsers

@gasman
Copy link
Collaborator

gasman commented Aug 8, 2019

Please see #5480 - have you tried clearing your browser cache (and running manage.py collectstatic, if this is a production site rather than a local development instance)?

@josephkohlmaier
Copy link
Author

josephkohlmaier commented Aug 8, 2019

Yes, I have done both as a first step, both locally and in the live Docker container although I now see an error (attached). Has the location for static files changed? When I set the version back to 2.5 and rebuild the container, the menu appears again without problems.

Screenshot 2019-08-08 at 14 20 36

Incidentally, there is something very strange happening which might be related (only locally, and after collectstatic, but not remotely) in another project – watch the icons appear and disappear as I hard refresh the page: https://www.dropbox.com/s/w8hkw9btdka4tne/icons-missing.mov?dl=0

As per #5480 this is an upgrade issue – ie. there must be something about existing file paths that causes this and possibly requires a fix or mention in the documentation.

@gasman
Copy link
Collaborator

gasman commented Aug 8, 2019

This definitely looks like a configuration issue causing static files from a previous Wagtail installation to show up - the icon font is one thing that has been updated in 2.6. From the video I notice that the icons are breaking when you navigate to another page, and fixed again when you hard refresh - which matches the behaviour we'd see if a STATICFILES_STORAGE backend that assigns distinct filenames for different versions, such as ManifestStaticFilesStorage, and those pages were being cached.

Will close this for now as it doesn't look like Wagtail itself is at fault here, but happy to investigate further if you're able to reproduce this consistently on a newly-created project. You might have more success asking on our support channels.

@rory-ferguson
Copy link

Having the same issue but on localhost, need to hard refresh for it to work... still looking for the cause

@DanielSwain
Copy link
Contributor

I've just encountered this same issue after updating six sites to 2.6.1. This issue occurs on only one site, and the only difference between the sites is that the problem site uses ModelAdminGroup to create two groups on the left menu. I have run collectstatic and hard refreshed many times to get the latest static files.

When I set an Event Listener Breakpoint in Chrome's dev tools to catch mouse clicks and then click on the Settings menu, on all other sites I can see the following js files called in this order:

  1. webpack:///./client/src/includes/initSubmenus.js
  2. https://mysite.com/static/wagtailadmin/js/vendor/jquery-3.2.1.min.js
  3. webpack:///./node_modules/react-dom/cjs/react-dom.production.min.js

On the problem site, I only see these js files accessed when I click on either the Settings menu or either of the two ModelAdminGroup menus:

  1. https://mysite.com/static/wagtailadmin/js/vendor/jquery-3.2.1.min.js
  2. webpack:///./node_modules/react-dom/cjs/react-dom.production.min.js

My development machine is Ubuntu 16.04. The production server is Ubuntu 18.04. Both use uWSGI/Nginx. Python is 3.6 on both. The problem behavior occurs on both machines. The problem site was previously at Wagtail 2.5.1.

@gasman
Copy link
Collaborator

gasman commented Sep 18, 2019

Hi @DanielSwain,
The bakerydemo demo site also has two ModelAdminGroups in the left menu, and we've been using that for testing and development on 2.6.x with no issues, so that wouldn't seem to be the cause of the problem in itself.

I'd suggest making a local copy of the affected site, and progressively removing apps and code until you arrive at a minimal test case that reproduces the issue - that should make it easier to see whether this is indeed a Wagtail bug, and if so, allow us to investigate further.

@adpio
Copy link

adpio commented Oct 10, 2019

I have the same problem. However I've found out that everything works fine in incognito mode (chrome and safari). Very odd...

To be clear: I've tried collectstatic + clearing cache + disabling all the browser extensions (I don't have any in safari) and it still only works in incognito

@DanielSwain
Copy link
Contributor

I just tried incognito mode with my problem site, and it does not work.

@DanielSwain
Copy link
Contributor

I finally solved this problem. I needed to display an image using Wagtails {% image %} tag on a ModelAdmin edit page. The image had to display below the other fields on the model. The only way I could determine to do this a year ago when Wagtail was at version 2.5 was to create a new version of Wagtail's base.html template in wagtailadmin. Wagtail's base.html had a major change in version 2.6:

<div class="nav-wrapper">

was changed to:

<aside class="nav-wrapper" data-nav-primary>

This data attribute is used as a selector for the Settings flyout menu. I finally discovered that the proper way to accomplish the display of the image is by using Django's {{ block.super }} command. I used {{ block.super }} to override within {{ block content }} and then, within that block and under the {{ block.super }} statement, I added the {% image %} tag and some explanatory text. I'm also going to propose a change to the docs here to mention {{ block.super }} in the same way that it is mentioned here.

@tomdyson
Copy link
Contributor

Thank you for following up @DanielSwain!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants