Skip to content

Commit 010e131

Browse files
committed
streamline check for markdown block
1 parent 07631ae commit 010e131

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tbx/core/templatetags/util_tags.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from tbx.core.utils.models import SocialMediaSettings
55
from wagtail.blocks import StreamValue
6-
from wagtailmarkdown.blocks import MarkdownBlock
76

87
register = template.Library()
98

@@ -105,6 +104,9 @@ def has_raw_html_block(value):
105104

106105
@register.filter(name="has_markdown_block")
107106
def has_markdown_block(value):
108-
if isinstance(value, StreamValue):
109-
return any(type(item.block) is MarkdownBlock for item in value)
110-
return False
107+
if not isinstance(value, StreamValue):
108+
return False
109+
110+
for block in value._raw_data:
111+
if block["type"] == "markdown":
112+
return True

0 commit comments

Comments
 (0)