jazzband / wagtailmenus

An app to help you manage and render menus in your Wagtail projects more effectively
MIT License
396 stars 138 forks source link

Silence errors by renaming panels on models #471

Closed katdom13 closed 9 months ago

katdom13 commented 9 months ago

When wagtailmenus is used on our sites, we usually encounter these warnings:

wagtailmenus.FlatMenu: (wagtailadmin.W002) FlatMenu.content_panels will have no effect on modeladmin editing
        HINT: Ensure that FlatMenu uses `panels` instead of `content_panels`or 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_panels`or 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_panels`or 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_panels`or 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.

even though edit_handler IS being used on the mixin used by views correctly, just because the class variables in the internal models are in this wagtail admin model check.

I find that renaming the class variables like so in wagtailmenus silences the warnings

ababic commented 9 months ago

I actually think it's the check in Wagtail that is the problem. I know it's well intentioned, but it's just a bit presumptuous for my liking. If it can't know for sure that something is a problem, it shouldn't be raising warnings like this.

In regards to the approach here: We can't just go renaming key attributes. Every project I've ever used this on makes changes to these attributes and expects the existing ones to be there.

katdom13 commented 9 months ago

Thanks for the prompt response, @ababic . I'll see if I can raise this to the Wagtail team after the holiday season.

Thanks!

MrCordeiro commented 9 months ago

Thanks for your help Kat! 🧡 If you open a new issue with the Wagtail team, please don't forget to link it either to this PR or to #464. Hopefully they can turn these warnings off.

As for now, I'll be closing the PR

MrCordeiro commented 7 months ago

I'll see if I can raise this to the Wagtail team after the holiday season.

Hi @katdom13! Let us know of your progress on that front, ok?

If you do open an issue with the Wagtail team, please add a link to it on #464 so that we can follow this issue in a single place. Thanks!