How to get settings extending BaseSetting data inside insert_editor_js hook in Wagtail

Viewed 16

I have this hook in Wagtail

@hooks.register('insert_editor_js')
def print_test():
    # settings = WYSIWYGSettings.for_request(request)   #  How to get this settings object?

    return format_html(
        """
        <script>
            console.log("printed from python");
        </script>
        """)


and this is the Settings model:


@register_setting
class WYSIWYGSettings(BaseSetting):
   ...

So, How can I access the settings data from inside the hook?

I can see that the problem is that the hook doesn't pass the request. Is there any workaround?

Thanks

0 Answers
Related