diff --git a/wagtail_footnotes/blocks.py b/wagtail_footnotes/blocks.py index 7ca8645..1d990bd 100644 --- a/wagtail_footnotes/blocks.py +++ b/wagtail_footnotes/blocks.py @@ -3,6 +3,7 @@ from django.core.exceptions import ValidationError from django.utils.safestring import mark_safe from wagtail.core.blocks import RichTextBlock +from wagtail.core.models import Page FIND_FOOTNOTE_TAG = re.compile(r'.*?') @@ -29,7 +30,7 @@ def replace_footnote_tags(self, value, html, context=None): else: new_context = self.get_context(value, parent_context=dict(context)) - if "page" not in new_context: + if "page" not in new_context or not isinstance(new_context["page"], Page): return html page = new_context["page"]