{
"fields": {
"body": "<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis rem repellat maxime porro ipsam nisi officiis repellendus, tempora recusandae molestiae, incidunt quibusdam necessitatibus explicabo quasi aperiam eligendi dolorem dolor obcaecati.</p>",
"logo": 23,
"carousel": "[{\"type\": \"carousel\", \"value\": {\"caption\": \"caption #1\", \"image\": 5, \"link\": \"\"}}, {\"type\": \"carousel\", \"value\": {\"caption\": \"\", \"image\": 6, \"link\": \"http://example.com\"}}, {\"type\": \"carousel\", \"value\": {\"caption\": \"Apply now\", \"image\": 7, \"link\": \"http://example.com\"}}]",
"icon": 23
},
"model": "core.homepage",
"pk": 4
},
#this blocks image does not get loaded from fixture
class CarouselBlock(StructBlock):
image = ImageChooserBlock(icon='image')
caption = CharBlock(blank=True, null=True, required=False)
link = URLBlock(blank=True, null=True, required=False)
class Meta:
label = "Carousel Block"
template = "blocks/carousel.html"
class CarouselHomeBlock(StreamBlock):
carousel = CarouselBlock()
class Meta:
template = 'blocks/carousel_home.html'
label = 'Carousel'
class HomePage(Page):
#subpage_types
logo = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
icon = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
carousel = StreamField(CarouselHomeBlock(), null=True, blank=True)
search_fields = ()
body = RichTextField(blank=True)
#custom properties and unicode() children() get_context() etc..
class Meta:
verbose_name = "Home page"
content_panels = [
MultiFieldPanel(Page.content_panels + [
FieldPanel('body', classname="full"),
], "Base"),
StreamFieldPanel('carousel'),
]
promote_panels = [
MultiFieldPanel(Page.promote_panels, "Common page configurations"),
MultiFieldPanel([
ImageChooserPanel('logo'),
ImageChooserPanel('icon'),
], "Display")
]