update hooks documentation to use mark_safe as no variables are used

pull/7576/head
LB Johnston 2021-10-06 20:22:45 +10:00 zatwierdzone przez LB (Ben Johnston)
rodzic e03c86f3f8
commit f453092d0c
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -498,7 +498,8 @@ Hooks for customising the editing interface for pages and snippets.
.. code-block:: python
from django.utils.html import format_html, format_html_join
from django.utils.html import format_html_join
from django.utils.safestring import mark_safe
from django.templatetags.static import static
from wagtail.core import hooks
@ -511,13 +512,12 @@ Hooks for customising the editing interface for pages and snippets.
js_includes = format_html_join('\n', '<script src="{0}"></script>',
((static(filename),) for filename in js_files)
)
# remember to use double '{{' so they are not parsed as template placeholders
return js_includes + format_html(
return js_includes + mark_safe(
"""
<script>
$(function() {{
$(function() {
$('button').raptorize();
}});
});
</script>
"""
)