In the model below I want to make the bottom_content
field in its entirety not required. How can I do this?
class ServicePage(Page):
top_content = StreamField(default_blocks + [
('two_columns', TwoColumnBlock()),
('three_columns', ThreeColumnBlock()),
])
bottom_content = StreamField(default_blocks + [
('two_columns', TwoColumnBlock()),
('three_columns', ThreeColumnBlock()),
])
search_fields = Page.search_fields + [
index.SearchField('top_content'),
index.SearchField('bottom_content'),
]
content_panels = Page.content_panels + [
StreamFieldPanel('top_content'),
StreamFieldPanel('bottom_content'),
InlinePanel('service_package', label='Packages')
]
StreamField also accepts an optional keyword argument blank, defaulting to false; when this is false, at least one block must be provided for the field to be considered valid.
from: - http://docs.wagtail.io/en/latest/topics/streamfield.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With