0

Since Wagtail 2.13.x, the render_form method is removed from the FieldBlock (A block inherited by most default blocks such as CharBlock, TextBlock etc.)

How are these blocks rendered using Wagtail 2.13.x?

A test for rendering a block is as follows:

def test_form_render(self):
    block = FormChooserBlock()

    test_form_html = block.render_form(self.form, "form")
    expected_html = "\n".join(
        [
            '<select name="form" placeholder="" id="form">',
            '<option value="">---------</option>',
            '<option value="%s" selected>Basic Form</option>' % self.form.id,
            "</select>",
        ]
    )
    self.assertInHTML(expected_html, test_form_html)

Obviously, this test breaks when upgrading to wagtail 2.13.x, because the render_form method is not an attribute of block anymore.

Vincent
  • 1,494
  • 12
  • 26

1 Answers1

1

Rendering a form is now handled entirely in client-side Javascript. There's not going to be a direct equivalent for the render_form method. Therefore, this test is not necessary anymore. You're basically testing Wagtail's own functionality.

Vincent
  • 1,494
  • 12
  • 26