Created
March 2, 2016 19:31
-
-
Save alexgleason/49307a97b446afc30ed6 to your computer and use it in GitHub Desktop.
WIP custom cards block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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