We have a model defined with a StreamField
that allows a DocumentChooserBlock
as follows:
class CustomPage(Page):
body = StreamField(
[("document", DocumentChooserBlock()),]
...
Our page template renders the CustomPage.body
field as follows:
{% block content %}
...
{% include_block page.body %}
...
{% endblock %}
By default, the PDF document uploaded via the StreamField
renders as a link.
How can I override the rendered output for the document link in the CustomPage.body
StreamField
, so that I can render the PDF in line with a JavaScript PDF widget?
If this is a common need, I would be interested in publishing a Wagtail extension for other projects to use.