python类register()的实例源码

wagtail_hooks.py 文件源码 项目:wagtailblocks_tabs 作者: alexgleason 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tabs_block_styles():
    return format_html(
        '<link rel="stylesheet" href="'
        + settings.STATIC_URL
        + 'wagtailblocks_tabs/css/wagtailblocks_tabs.css">'
    )


# @hooks.register('insert_editor_js')
# def tabs_block_scripts():
#     js_files = [
#         'wagtailblocks_tabs/js/tabs.js',
#     ]
#     js_includes = format_html_join(
#         '\n', '<script src="{0}{1}"></script>',
#         ((settings.STATIC_URL, filename) for filename in js_files)
#     )
#     return js_includes + format_html(
#         """
#         <script>
#           $( document ).ready(tabs_block_init());
#         </script>
#         """
#     )
edit_handlers.py 文件源码 项目:wagtailmodelchooser 作者: Naeka 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def register_with_wagtail(cls):
        @hooks.register('register_admin_urls')
        def register_admin_urls():
            return cls.get_admin_urls_for_registration()

        @hooks.register('insert_editor_js')
        def insert_editor_js():
            return cls.get_editor_js_for_registration()


问题


面经


文章

微信
公众号

扫码关注公众号