wagtail 自定义管理面板
wagtail customized admin panels
有没有办法自定义我自己的管理面板,而不是在样式方面。我希望实现的是一个分析选项卡,类似于 wagalytics . The issue im having with wagalytics is that it is using google analytics , and google analytics is blocked by most adblockers and Mozilla fire fox , making the data really unreliable. As such i wish to utitlize other services like django-analytical to my wagtail administration page with a graph similar to that of wagalytics . However , i have not yet found any resources online that teaches me to override the admin and create my own customized panel (different from the customized tabs here)。
有人能指出我正确的方向吗?
要将页面 (link) 添加到 Wagtail 管理菜单,您可以使用钩子 register_admin_menu_item
。
创建一个文件 my-app/wagtail_hooks.py
,这将由 Wagtail 运行 挂钩自定义功能。
rom django.urls import reverse
from wagtail.core import hooks
from wagtail.admin.menu import MenuItem
@hooks.register('register_admin_menu_item')
def register_frank_menu_item():
return MenuItem('Frank', reverse('name-of-analytics-url'), classnames='icon icon-folder-inverse', order=10000)
您需要自己设置视图 reporting/graphs,您可以查看 wagalytics
的来源或简单地提供报告 django-analytics
提供的任何内容。
如果您希望您的视图使用模板来扩展 Wagtail 管理模板,您可以使用 wagtailadmin/base.html
来实现。例如{% extends "wagtailadmin/base.html" %}
。注意:您可能需要将 'wagtail.admin',
添加到 INSTALLED_APPS
.
有没有办法自定义我自己的管理面板,而不是在样式方面。我希望实现的是一个分析选项卡,类似于 wagalytics . The issue im having with wagalytics is that it is using google analytics , and google analytics is blocked by most adblockers and Mozilla fire fox , making the data really unreliable. As such i wish to utitlize other services like django-analytical to my wagtail administration page with a graph similar to that of wagalytics . However , i have not yet found any resources online that teaches me to override the admin and create my own customized panel (different from the customized tabs here)。
有人能指出我正确的方向吗?
要将页面 (link) 添加到 Wagtail 管理菜单,您可以使用钩子 register_admin_menu_item
。
创建一个文件 my-app/wagtail_hooks.py
,这将由 Wagtail 运行 挂钩自定义功能。
rom django.urls import reverse
from wagtail.core import hooks
from wagtail.admin.menu import MenuItem
@hooks.register('register_admin_menu_item')
def register_frank_menu_item():
return MenuItem('Frank', reverse('name-of-analytics-url'), classnames='icon icon-folder-inverse', order=10000)
您需要自己设置视图 reporting/graphs,您可以查看 wagalytics
的来源或简单地提供报告 django-analytics
提供的任何内容。
如果您希望您的视图使用模板来扩展 Wagtail 管理模板,您可以使用 wagtailadmin/base.html
来实现。例如{% extends "wagtailadmin/base.html" %}
。注意:您可能需要将 'wagtail.admin',
添加到 INSTALLED_APPS
.