Wagtailmenus 2.11 release notes

What’s new?

Replace the ModelAdmin classes used by wagtailmenus with your own

Previously, the only way to override any of the admin functionality within wagtailmenus was to resort to monkey-patching, which is obviously not ideal.

I wanted to provide a documented, officially supported way to do this, by allowing the default wagtail.contrib.modelamin.ModelAdmin classes in wagtailmenus to be swapped out for custom ones with settings.

For more information see the new entries in the settings reference docs:

Minor changes & bug fixes

  • Added support for Wagtail version 2.1.

  • Added new ‘Wagtail’ trove classifiers in setup.py to reflect Wagtail version support.

  • Updated runtests.py to pass on any unparsed option arguments to Django’s test method.

  • Updated runtests.py to filter out deprecation warnings originating from other apps by default.

  • Updated MenuItem.relative_url() to accept a request parameter (for parity with wagtail.core.models.Page.relative_url()), so that it can pass it on to the page method.

  • Updated Menu.prime_menu_items() to send the current HttpRequest to that MenuItem.relative_url() and Page.relative_url().

  • Moved most ‘App settings related’ tests to wagtailmenus.conf.tests, so that they’re all in one place.

  • Updated admin views to utilise wagtail.admin.messages.validation_error() for reporting field-specific and non-field errors (Wagtail 2.1 has this built-in, but Wagtail 2.0 does not).

  • Replaced the custom app settings module with a django-cogwheels settings helper and removed a lot of the tests that existed to test its workings.

  • Moved remaining app settings tests to wagtailmenus.conf.tests.

Deprecations

  • If you’re using custom MenuItem models in your project, and are overriding relative_url(), you should update the method signature on your custom model to accept a request keyword argument, and it on to link_page.relative_url() and super().relative_url() (in addition to site) if calling either of those. This will be mandatory in wagtailmenus 1.13.

Upgrade considerations

  • Dropped support for Wagtail versions 1.10 to 1.13.

  • Dropped support for Django versions 1.8 to 1.10.

  • Menu.prime_menu_items() now returns a list instead of a generator. This is required to allow the method to raise warnings.

  • Wagtailmenus’ custom modeladmin classes have moved from wagtailmenus.wagtail_hooks to a new wagtailmenus.modeladmin module. Importing FlatMenuAdmin or MainMenuAdmin from the wagtail_hooks will still continue to work, but any references to wagtailmenus.wagtail_hooks.FlatMenuButtonHelper will need to be updated.

  • If for any reason you are importing view classes directly from wagtailmenus.wagtail_hooks, that will no longer work. You will have to update your code to import view classes from the views module itself (wagtailmenus.views).