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

Wagtail 5.2 throws wagtailadmin.W002 warnings #464

Closed
aliceni81 opened this issue Nov 6, 2023 · 4 comments
Closed

Wagtail 5.2 throws wagtailadmin.W002 warnings #464

aliceni81 opened this issue Nov 6, 2023 · 4 comments

Comments

@aliceni81
Copy link

When I upgrade wagtail version from 5.1.3 to 5.2, I got the following the warnings:
wagtailmenus.FlatMenu: (wagtailadmin.W002) FlatMenu.content_panels will have no effect on modeladmin editing
HINT: Ensure that FlatMenu uses panels instead of content_panelsor set up an edit_handler if you want a tabbed editing interface.
There are no default tabs on non-Page models so there will be no Content tab for the content_panels to render in.
wagtailmenus.FlatMenu: (wagtailadmin.W002) FlatMenu.settings_panels will have no effect on modeladmin editing
HINT: Ensure that FlatMenu uses panels instead of settings_panelsor set up an edit_handler if you want a tabbed editing interface.
There are no default tabs on non-Page models so there will be no Settings tab for the settings_panels to render in.
wagtailmenus.MainMenu: (wagtailadmin.W002) MainMenu.content_panels will have no effect on modeladmin editing
HINT: Ensure that MainMenu uses panels instead of content_panelsor set up an edit_handler if you want a tabbed editing interface.
There are no default tabs on non-Page models so there will be no Content tab for the content_panels to render in.
wagtailmenus.MainMenu: (wagtailadmin.W002) MainMenu.settings_panels will have no effect on modeladmin editing
HINT: Ensure that MainMenu uses panels instead of settings_panelsor set up an edit_handler if you want a tabbed editing interface.
There are no default tabs on non-Page models so there will be no Settings tab for the settings_panels to render in.

Wagtail version: 5.2
Wagtailmenu version: 3.1.9

@aliceni81 aliceni81 changed the title Compatible with Wagtail 5.2 Add Support tp Wagtail 5.2 Nov 6, 2023
@aliceni81 aliceni81 changed the title Add Support tp Wagtail 5.2 Add Support to Wagtail 5.2 Nov 6, 2023
@ababic
Copy link
Collaborator

ababic commented Nov 11, 2023

This warning can be safely ignored. The add/edit views for wagtailmenus use this mixin, which takes care of creating an edit handler for the view to use.

@MrCordeiro
Copy link
Contributor

@ababic , do you think it makes sense filter out these specific warnings with warnings.filterwarnings + an explanatory comment?

@ababic
Copy link
Collaborator

ababic commented Nov 12, 2023

@MrCordeiro if trivial, then sure. I can't say I'm very familiar with that API though. It looks a little cumbersome.

@MrCordeiro
Copy link
Contributor

MrCordeiro commented Dec 4, 2023

Just a small update on that item.

The warnings come from Django's system checks framework. The problem is that a third-party app can't directly manipulate checks registered by other apps (Wagtail, in this case).

The workaround is having developers silence these warnings in their applications, using the SILENCED_SYSTEM_CHECKS settings:

# settings.py
SILENCED_SYSTEM_CHECKS = ["wagtailadmin.W002"]

The problem with this, of course, is that it will also silence any instance where the warning shouldn't be ignored. So I don't recommend it.


I'm going to close this issue for now.

I'm also leaving a copy of @ababic's answer to #468 so that visitors can quickly find the reason why they can safely ignore those warnings:

These changes aren't actually needed, because the custom views used by wagtailmenus generate their own edit handler from the content_panels and settings_panels attributes on the model.

Adding these edit_handler attributes to the models actually means that, in order to add their own panels to either tab, developers need to completely override edit_handler instead of just adding items to content_panels and settings_panels (like they can currently).

Originally posted by @ababic in #468 (comment)

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