How can I pass the user selected value for background_color
object that is in my PostPage Page
class as the default value for another ColorField
that's within my streamfield blocks?
class PostPage(Page):
# The user selected value for background_color is the object that I'm trying to pass as a default for a streamfield block.
background_color = ColorField(default="#000000")
# streamfield in question
blog_builder = StreamField(BlogFeatures(), blank=True)
content_panels = Page.content_panels + [
NativeColorPanel('background_color'),
StreamFieldPanel("blog_builder"),
]
edit_handler = TabbedInterface([
ObjectList(content_panels, heading="Content"),
])
Here is my streamfield class that uses StreamBlock
:
class BlogFeatures(StreamBlock):
simple_list = SimpleList()
I use a Structblock
to help achieve my streamfield goals:
class SimpleList(StructBlock):
...
# how can I set the default value of this background_color to match the user selected value from the Page Model called PostPage.
background_color = NativeColorBlock(default="#ffffff")
...