本文整理匯總了Python中wagtail.admin.menu.MenuItem方法的典型用法代碼示例。如果您正苦於以下問題:Python menu.MenuItem方法的具體用法?Python menu.MenuItem怎麽用?Python menu.MenuItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wagtail.admin.menu
的用法示例。
在下文中一共展示了menu.MenuItem方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: register_django_admin_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_django_admin_menu_item():
return MenuItem(_('Django Admin'), reverse('admin:index'),
classnames='icon icon-cogs', order=700)
示例2: register_frank_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_frank_menu_item():
return MenuItem(
'Oscar', reverse('dashboard:index'),
classnames='icon icon-cogs', order=10000)
示例3: test_menuitem_reverse_lazy_url_pass
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def test_menuitem_reverse_lazy_url_pass(self):
menuitem = MenuItem(_('Test'), reverse_lazy('wagtailadmin_home'))
self.assertEqual(menuitem.is_active(self.request), True)
示例4: register_styleguide_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_styleguide_menu_item():
return MenuItem(
_('Styleguide'),
reverse('wagtailstyleguide'),
icon_name='image',
order=1000
)
示例5: register_dashboard_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_dashboard_menu_item():
apply_home = ApplyHomePage.objects.first()
return MenuItem(
'Apply Dashboard',
urljoin(apply_home.url, reverse('dashboard:dashboard', 'hypha.apply.urls')),
classnames='icon icon-arrow-left',
order=100000,
)
示例6: register_500_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_500_menu_item():
return MenuItem('Generate 500', reverse('throw_error'), classnames='icon icon-warning', order=10000)
示例7: get_submenu_items
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def get_submenu_items(self):
menu_items = []
item_order = 1
for modeladmin in self.modeladmin_instances:
menu_items.append(modeladmin.get_menu_item(order=item_order))
item_order += 1
menu_items.append(MenuItem('Registrations', '/django-admin/events/registration/', classnames='icon icon-group', order=3000))
return menu_items
示例8: register_errata_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_errata_menu_item():
return MenuItem('Errata', '/django-admin/errata/errata', classnames='icon icon-form', order=10000)
# @hooks.register('register_admin_menu_item')
# def register_errata_menu_item():
# return MenuItem('Errata (beta)', '/api/errata/admin/dashboard/', classnames='icon icon-form', order=10000)
示例9: register_partner_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_partner_menu_item():
return MenuItem('Partners', '/django-admin/salesforce/partner/', classnames='icon icon-group', order=3000)
示例10: register_styleguide_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_styleguide_menu_item():
return MenuItem(
_('Analytics'),
reverse('wagalytics_dashboard'),
classnames='icon icon-fa-bar-chart',
order=1000
)
示例11: remove_menu_if_unverified
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def remove_menu_if_unverified(request, menu_items):
"""Remove the sidebar menu items if the user is unverified."""
if (settings.WAGTAIL_2FA_REQUIRED and getattr(request.user, "enable_2fa", True)
and not request.user.is_verified()):
menu_items.clear()
menu_items.append(MenuItem("2FA Setup", reverse('wagtail_2fa_device_list', kwargs={'user_id': request.user.id})))
示例12: register_images_menu_item
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_images_menu_item():
return MenuItem(
_('Videos'), reverse('wagtailvideos:index'),
name='videos', classnames='icon icon-media', order=300
)
示例13: register_menu_settings
# 需要導入模塊: from wagtail.admin import menu [as 別名]
# 或者: from wagtail.admin.menu import MenuItem [as 別名]
def register_menu_settings():
return MenuItem(
_('Link Checker'),
urlresolvers.reverse('wagtaillinkchecker'),
classnames='icon icon-link',
order=300
)