Skip to content

Add support for general FieldPanel with Wagtail 3.0+ #155

@zerolab

Description

@zerolab

References:

Where possible, third-party packages that implement their own field panel types should be updated to allow using a plain FieldPanel instead, in line with Wagtail dropping its own special-purpose field panel types such as StreamFieldPanel and ImageChooserPanel. The steps for doing this will depend on the package’s functionality, but in general:

  • If the panel sets a custom template, your code should instead define a Widget class that produces your desired HTML rendering.
  • If the panel provides a widget_overrides method, your code should instead call register_form_field_override so that the desired widget is always selected for the relevant model field type.
  • If the panel provides a get_comparison_class method, your code should instead call wagtail.admin.compare.register_comparison_class to register the comparison class against the relevant model field type.

Fix deprecations too:

deprecations
tests/test_edit_handlers.py:202: RemovedInWagtail50Warning: The MediaChooserPanel.bind_to() method has been replaced by bind_to_model(model) and get_bound_panel(instance=instance, request=request, form=form)
  media_chooser_panel = self.my_media_chooser_panel.bind_to(
/home/runner/work/wagtailmedia/wagtailmedia/tests/test_edit_handlers.py:205: RemovedInWagtail50Warning: Panel.render_as_field is deprecated. Use render_html instead
  result = media_chooser_panel.render_as_field()
tests/test_edit_handlers.py:143: RemovedInWagtail50Warning: Panel.render_as_field is deprecated. Use render_html instead
  result = self.media_chooser_panel.render_as_field()
tests/test_edit_handlers.py:172: RemovedInWagtail50Warning: Panel.render_as_field is deprecated. Use render_html instead
  result = media_chooser_panel.render_as_field()
tests/test_edit_handlers.py:248: RemovedInWagtail50Warning: Panel.render_as_field is deprecated. Use render_html instead
  media_chooser_panel.render_as_field(),
tests/test_edit_handlers.py:121: RemovedInWagtail50Warning: Panel.render_as_field is deprecated. Use render_html instead
  self.media_chooser_panel.render_as_field(),
tests/test_edit_handlers.py:130: RemovedInWagtail50Warning: Panel.render_as_field is deprecated. Use render_html instead
  media_chooser_panel.render_as_field(),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions