Closed digitaljohn closed 4 years ago
@digitaljohn did you find a solution?
I have the same issue, I can't resolve any of the blocks inside a ListBlock
, even using a subclass of StructBlock.
Also, I have a problem using a ImageChooserBlock()
inside the ListBlock
:
"message": "int() argument must be a string, a bytes-like object or a number, not 'Image'",
My StreamField
looks like this:
body = StreamField([
('paragraph', blocks.RichTextBlock()),
('slider', blocks.StructBlock([
('author', blocks.CharBlock()),
('sliders', blocks.ListBlock(blocks.StructBlock([
('caption', blocks.CharBlock()),
('image', ImageChooserBlock()),
])))
])),
])
My query is also very verbose. Am I doing something wrong?
query Articles {
pages {
... on Article {
slug
description
body {
... on RichTextBlock {
value
}
... on StructBlock {
blocks {
... on CharBlock {
value
}
... on ListBlock {
items {
... on StructBlock {
blocks {
... on CharBlock {
value
}
... on ImageChooserBlock {
image {
src
}
}
}
}
}
}
}
}
}
}
}
}
@claudiopedrom we did not find a solution and ended up making our approach less deep. It appears this functionality simply is not complete. 🤷♂
@digitaljohn @claudiopedrom, @NathHorrigan maintains this in his free time, so any tweak/improvement is more than welcome.
This was fixed in https://github.com/torchbox/wagtail-grapple/pull/47
Please see this PR on how to use ListBlock
@digitaljohn @claudiopedrom
Thanks @NathHorrigan !
I'll have a look as soon as I have an opportunity.
Thanks @NathHorrigan !
I'm trying to create a simple Gallery Block working for use within a StreamField field. For example:
Within the GraphQL response when querying,
items
is being returned as an object rather than array of items and the object returned is actually itself.Is this implementation complete? I'm by far a Python expert but could it be to do with the below line of code?
https://github.com/torchbox/wagtail-grapple/blob/cb17c951b7b47a014aebccdf15358ac241acd86c/grapple/types/streamfield.py#L329
The items resolve to itself?