I'm following the Wagtail docs to create a navigation, but it's recommend to use based on 'Snippets', so I would like to change the sidebar to show "Navigation" or "Menu" instead of 'Snippets', is that possible?
But when I use just like the docs recommends for sidebar changes:
sidebar_content_panels = [
SnippetChooserPanel('advert', Advert),
InlinePanel('related_links', label="Related links"),
]
The sidebar_content_panels
code is not relevant here - it demonstrates how you would add an extra tab to the page editor, if your pages contained "main content" and "sidebar content" that you wanted to keep separate. It's nothing to do with the sidebar menu in the Wagtail admin.
It's possible to add new items to the admin menu using the register_admin_menu_item
hook (http://docs.wagtail.io/en/v1.0/reference/hooks.html#register-admin-menu-item), but this doesn't support editing an existing item, so it won't be possible to change the label of the 'snippets' menu. However, you could look at the 'wagtailmodeladmin' package https://github.com/ababic/wagtailmodeladmin - this allows you to set up admin areas that work like the snippet editor, but exist at the top level of the menu.
Wagtail allows you to create custom menu on admin panel sidebar by extending wagtail's ModelAdmin
you can check the example and documentation for new v2.4 here.
https://docs.wagtail.io/en/v2.4/reference/contrib/modeladmin/index.html#summary-of-features
来源:https://stackoverflow.com/questions/31822361/how-can-i-change-the-sidebar-from-wagtail