如何访问 Wagtail 片段菜单

How to access Wagtail snippets menu

我是 运行 Wagtail v2.8,我想使用片段。文档说

You can access the Snippets menu by clicking on the ‘Snippets’ link in the left-hand menu bar.

我的显示没有 'Snippets' 项。我有

INSTALLED_APPS = [
    ...
    'wagtail.snippets',
    ...]

我需要做什么?

你需要register a model as a snippet using @register_snippet. If you ForeignKey to a Django model and need to choose it in the Wagtail admin, you can use SnippetChooserPanel in your content_panels or panels definition: https://docs.wagtail.io/en/latest/reference/pages/panels.html#module-wagtail.snippets.edit_handlers

根据您需要执行的操作,您可能会发现使用 site setting 更合适。