Skip to content

Unable to export form field through API fields #217

@shinderucha

Description

@shinderucha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions