-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Hi All,
I am trying to choose a created form through WagtailFormBlock() using ChoiceBlock and then export the selected form through API fields.
Code for ChoiceBlock is as below -
def getFormblockChoices():
choices = []
forms = Form.objects.all()
for form in forms:
choices.append((form.id, form.title))
return choices
class WagtailFormBlock(blocks.StructBlock):
# FORMBLOCK_CHOICES = getFormblockChoices()
form = blocks.ChoiceBlock(choices=getFormblockChoices, required=False)
form_action = blocks.CharBlock(
required=False,
help_text=(
'The form post action. "" or "." for the current page or a url'))
form_reference = InfoBlock(
required=False,
help_text=("This form will be given a unique reference once saved"), )
However, I am able to choose a form and publish the page but the fields are not visible through API.
Please let me know.