Skip to content

Instantly share code, notes, and snippets.

@alexgleason
Created March 2, 2016 19:31
Show Gist options
  • Save alexgleason/49307a97b446afc30ed6 to your computer and use it in GitHub Desktop.
Save alexgleason/49307a97b446afc30ed6 to your computer and use it in GitHub Desktop.
WIP custom cards block
from wagtail.wagtailcore.blocks import (
ListBlock,
StructBlock,
CharBlock,
TextBlock,
PageChooserBlock
)
from wagtail.wagtailimages.blocks import ImageChooserBlock
class CardsBlock(ListBlock):
def __init__(self, **kwargs):
child_block = StructBlock([
('image', ImageChooserBlock(required=False)),
('title', CharBlock()),
('text', TextBlock()),
('link', PageChooserBlock(required=False)),
])
super(CardsBlock, self).__init__(child_block, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment