Wagtailmenus 2.10 release notes

Note

In order to keep wagtailmenus working with the latest versions of Wagtail and Django, with code that is clean and maintainable, this version will be the last feature release to support Wagtail versions earlier than 2.0, and Django versions earlier than 1.11.

Minor changes & bug fixes

  • Optimised MenuWithMenuItems.get_top_level_items() and AbstractFlatMenu.get_for_site() to use fewer database queries.
  • Configured sphinxcontrib.spelling and used to correct spelling errors in docs.
  • Updated testing and documentation dependencies.
  • Added Latin American Spanish translations (thanks to José Luis).

Deprecations

The wagtailmenus.app_settings module is deprecated

If you’re importing this in your project from it’s previous location, you should update the import statements in your code to use the new import path.

So, instead of:

from wagtailmenus import app_settings

Do:

from wagtailmenus.conf import settings

The wagtailmenus.constants module is deprecated

If you’re importing this in your project from it’s previous location, you should update the import statements in your code to use the new import path.

So, instead of:

from wagtailmenus import constants

Do:

from wagtailmenus.conf import constants

The WAGTAILMENUS_CHILDREN_MENU_CLASS_PATH setting is deprecated

If you’re using this in your project’s settings to override the menu class used for rendering children menus, you’ll want to change this:

# settings/base.py

WAGTAILMENUS_CHILDREN_MENU_CLASS_PATH = 'project.app.module.Class'

To this (without the “_PATH” on the end):

WAGTAILMENUS_CHILDREN_MENU_CLASS = 'project.app.module.Class'

The WAGTAILMENUS_SECTION_MENU_CLASS_PATH setting is deprecated

If you’re using this in your project’s settings to override the menu class used for rendering section menus, you’ll want to change this:

# settings/base.py

WAGTAILMENUS_SECTION_MENU_CLASS_PATH = 'project.app.module.Class'

To this (without the “_PATH” on the end):

WAGTAILMENUS_SECTION_MENU_CLASS = 'project.app.module.Class'

Upgrade considerations

FLAT_MENU_MODEL_CLASS has been removed from app settings

If you’re referencing FLAT_MENU_MODEL_CLASS directly from wagtailmenus’ app settings module, then you may need to make some changes.

If you only need the ‘model string’ for the model (for example, to use in a ForeignKey or ManyToManyField field definition), you should use wagtailmenus.get_flat_menu_model_string() instead.

If you need the Django model class itself, use wagtailmenus.get_flat_menu_model().

The CHILDREN_MENU_CLASS app setting no longer returns a class

If you’re referencing CHILDREN_MENU_CLASS attribute on wagtailmenus’ app settings module, then you may need to make some changes.

The attribute still exists, but now only returns the import path of the class as a string, rather than the class itself.

If you need to access the class itself, you can use the app settings module’s new get_object() method, like so:

from wagtailmenus.conf import settings

menu_class = settings.get_object('CHILDREN_MENU_CLASS')

The SECTION_MENU_CLASS app setting no longer returns a class

If you’re referencing SECTION_MENU_CLASS attribute on wagtailmenus’ app settings module, then you may need to make some changes.

The attribute still exists, but now only returns the import path of the class as a string, rather than the class itself.

If you need to access the class itself, you can use the app settings module’s new get_object() method, like so:

from wagtailmenus.conf import settings

menu_class = settings.get_object('SECTION_MENU_CLASS')