How can I change the sidebar from Wagtail?

I am following the Wagtail docs to create navigation, but it is recommended to use it based on "fragments", so I would like to change the sidebar to show "Navigation" or "Menu" instead of "Fragments", is this possible? enter image description here

But when I use exactly the same as the docs recommend to change the sidebar:

sidebar_content_panels = [
    SnippetChooserPanel('advert', Advert),
    InlinePanel('related_links', label="Related links"),
]

      

So it raises the AttributeError attribute: enter image description here

+3


source to share


2 answers


The code sidebar_content_panels

is not relevant here - it demonstrates how to add an extra tab to the page editor if your pages contained "main content" and "sidebar content" that you wanted to keep separately. It has nothing to do with the sidebar menu in the Wagtail admin.



It is 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 does not support editing an existing item. so you cannot change the Slices menu label. However, you can take a look at the "wagtailmodeladmin" package at https://github.com/ababic/wagtailmodeladmin - this allows you to configure admin scopes that act like a snippet editor but exist at the top menu level.

+7


source


Wagtail allows you to create a custom admin sidebar menu by extending the wagtail ModelAdmin

You can check the example and documentation for the new v2.4 here .



https://docs.wagtail.io/en/v2.4/reference/contrib/modeladmin/index.html#summary-of-features

0


source







All Articles