v0.14 - StreamField callables
This release adds the much missed ability to use custom StreamField
blocks callables or properties that is used aplenty with Page
models.
class TextWithCallableBlock(blocks.StructBlock):
text = blocks.CharBlock()
graphql_fields = [
GraphQLString("text"),
GraphQLString("label"),
GraphQLField("my_custom_field", source="get_custom_field"),
]
@property
def label(self):
return "my block property"
def get_custom_field(self, *args, **kwargs):
return "welcome, callable source in StreamField"
This feature was developed by @kbayliss.