-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathblocks.py
More file actions
29 lines (22 loc) · 774 Bytes
/
blocks.py
File metadata and controls
29 lines (22 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from wagtail.blocks import CharBlock
from wagtail.blocks import RichTextBlock
from wagtail.blocks import StructBlock
from wagtail.blocks import StreamBlock
from wagtail.blocks import URLBlock
from wagtail.embeds.blocks import EmbedBlock
from wagtail.images.blocks import ImageChooserBlock
from wagtailmarkdown.blocks import MarkdownBlock
class CustomVideoBlock(StructBlock):
video = EmbedBlock()
thumbnail = ImageChooserBlock()
class Meta:
template = "blocks/custom_video_block.html"
class PollBlock(StreamBlock):
poll_choice = CharBlock(max_length=200)
POST_BLOCKS = [
("rich_text", RichTextBlock()),
("markdown", MarkdownBlock()),
("url", URLBlock()),
("video", CustomVideoBlock(label="Video")),
("poll", PollBlock()),
]