Skip to content

Commit

Permalink
Only attempt to add footnotes if the context's 'page' is a Page object
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbridge committed Sep 10, 2021
1 parent 474c19d commit d1db7e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wagtail_footnotes/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<footnote id="(.*?)">.*?</footnote>')

Expand All @@ -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"]
Expand Down

0 comments on commit d1db7e5

Please sign in to comment.