Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@hooks.register('register_admin_urls')
def register_admin_urls():
return [
url(r'^embeds/', include(urls, namespace='wagtailembeds')),
]
@hooks.register('insert_editor_js')
def editor_js():
""" Adds additional JavaScript files or code snippets to the page editor. """
js_files = ['hallo-readinglevel-plugin.js','draftail-readinglevel-plugin.js']
js_includes = format_html_join('\n', '',
((settings.STATIC_URL, filename) for filename in js_files)
)
return js_includes + format_html(
"""
@hooks.register('register_account_menu_item')
def register_account_notification_preferences(request):
user_perms = UserPagePermissionsProxy(request.user)
if user_perms.can_edit_pages() or user_perms.can_publish_pages():
return {
'url': reverse('wagtailadmin_account_notification_preferences'),
'label': _('Notification preferences'),
'help_text': _('Choose which email notifications to receive.'),
}
@hooks.register('register_group_permission_panel')
def register_video_permissions_panel():
return GroupVideoPermissionFormSet
@hooks.register('insert_editor_js')
def editor_js():
js_files = [
static('wagtailmedia/js/media-chooser.js'),
]
js_includes = format_html_join(
'\n', '',
((filename, ) for filename in js_files)
)
return js_includes + format_html(
"""
""",
reverse('wagtailmedia:chooser')
)
@hooks.register('register_permissions')
def register_permissions():
return Permission.objects.filter(content_type__app_label='wagtailcore',
codename__in=['add_site', 'change_site', 'delete_site'])
@hooks.register('construct_explorer_page_queryset')
def construct_explorer_page_queryset(parent_page, queryset, request):
return self.modify_explorer_page_queryset(
parent_page, queryset, request)
@hooks.register('register_settings_menu_item')
def register_styleguide_menu_item():
return MenuItem(
_('Styleguide'),
reverse('wagtailstyleguide'),
classnames='icon icon-image',
order=1000
)
@hooks.register('insert_global_admin_js')
def global_admin_js():
return format_html(
''.format(
path=static('wagtailtrans/js/site_languages_editor.js'))
)
@hooks.register('register_admin_menu_item')
def register_forms_menu_item():
return FormsMenuItem(
_('Forms'), reverse('wagtailforms:index'),
name='forms', classnames='icon icon-form', order=700
)