# Wagtail 5.2 release notes - IN DEVELOPMENT _Unreleased_ ```{contents} --- local: depth: 1 --- ``` ## What's new ### OpenSearch support [OpenSearch](https://opensearch.org/) is now formally supported as an alternative to Elasticsearch. For configuration details, see [OpenSearch configuration](opensearch). This feature was developed by Matt Westcott. ### Responsive & multi-format images with the picture tag Wagtail has new template tags to reduce the performance and environmental footprint of images: * The `picture` tag generates images in multiple formats and-or sizes in one batch, creating an HTML `` tag. * The `srcset_image` tag generates images in multiple sizes, creating an `` tag with a `srcset` attribute. We expect those changes to greatly reduce the weight of images for all Wagtail sites. We encourage all site implementers to consider using them to improve the performance of the sites and reduce their carbon footprint. For further details, For more details, see [](multiple_formats) and [](responsive_images). Those new template tags are also supported in Jinja templates, see [](jinja2) for the Jinja API. This feature was developed by Paarth Agarwal and Thibaud Colas as part of the Google Summer of Code program and a [partnership with the Green Web Foundation](https://www.thegreenwebfoundation.org/news/working-with-the-wagtail-community-on-the-summer-of-code/) and Green Coding Berlin, with support from Dan Braghiș, Thibaud Colas, Sage Abdullah, Arne Tarara (Green Coding Berlin), and Chris Adams (Green Web Foundation). We also thank Aman Pandey for introducing [AVIF support](image_file_formats) in Wagtail 5.1, Andy Babic for creating [`AbstractImage.get_renditions()`](image_renditions_multiple) in the same release; and Storm Heg, Mitchel Cabuloy, Coen van der Kamp, Tom Dyson, and Chris Lawton for their feedback on [RFC 71](https://github.com/wagtail/rfcs/pull/71). ### Other features * Add support for Python 3.12 (Matt Westcott) * Add [`wagtailcache`](wagtailcache) and [`wagtailpagecache`](wagtailpagecache) template tags to ensure previewing Pages or Snippets will not be cached (Jake Howard) * Always set help text element ID for form fields with help text in `field.html` template (Sage Abdullah) * Move `SnippetViewSet` menu registration mechanism to base `ViewSet` class (Sage Abdullah) * Enable reference index tracking for models registered with `ModelViewSet` (Sage Abdullah) * When copying a page or creating an alias, copy its view restrictions to the destination (Sandeep Choudhary, Suyash Singh) * Support pickling of StreamField values (pySilver) * Move `SnippetViewSet` template override mechanism to `ModelViewSet` (Sage Abdullah) * Move `SnippetViewSet.list_display` to `ModelViewSet` (Sage Abdullah) * Remove `wagtail.publish` log action on aliases when they are created from live source pages or the source page is published (Dan Braghis) * Remove `wagtail.unpublish` log action on aliases when source page is unpublished (Dan Braghis) * Add compare buttons to workflow dashboard panel (Matt Westcott) * Add the ability to use filters and to export listings in generic `IndexView` (Sage Abdullah) * Move `list_filter`, `filterset_class`, `search_fields`, `search_backend_name`, `list_export`, `export_filename`, `list_per_page`, and `ordering` from `SnippetViewSet` to `ModelViewSet` (Sage Abdullah) * Add default header titles to generic `IndexView` and `CreateView` (Sage Abdullah) * Allow overriding `IndexView.export_headings` via `ModelViewSet` (Christer Jensen, Sage Abdullah) * Support specifying a `get_object_list` method on `ChooserViewSet` (Matt Westcott) * Add `linked_fields` mechanism on chooser widgets to allow choices to be limited by fields on the calling page (Matt Westcott) * Add support for merging cells within `TableBlock` with the [`mergedCells` option](table_block_options) (Gareth Palmer) * When adding a panel within `InlinePanel`, focus will now shift to that content similar to `StreamField` (Faishal Manzar) * Show the full first published at date within a tooltip on the Page status sidebar on the relative date (Rohit Sharma) * Extract generic breadcrumbs functionality from page breadcrumbs (Sage Abdullah) * Add support for `placement` in `human_readable_date` the tooltip template tag (Rohit Sharma) * Add breadcrumbs to generic model views (Sage Abdullah) * Support passing extra context variables via the `{% component %}` tag (Matt Westcott) * Allow subclasses of `PagesAPIViewSet` override default Page model via the `model` attribute (Neeraj Yetheendran, Herbert Poul) * Allow `ModelViewSet` to be used with models that have non-integer primary keys (Sage Abdullah) * Add the ability to set an external link/text for promoted search result entries (TopDevPros, Brad Busenius) * Add support for subject and body in the Email link chooser form (TopDevPros, Alexandre Joly) * Extract generic `HistoryView` from snippets and add it to `ModelViewSet` (Sage Abdullah) * Add generic `UsageView` to `ModelViewSet` (Sage Abdullah) * Add the ability to define listing buttons on generic `IndexView` (Sage Abdullah) * Add a visual progress bar to the output of the `wagtail_update_image_renditions` management command (Faishal Manzar) * Increase the read buffer size to improve efficiency and performance when generating file hashes for document or image uploads, use `hashlib.file_digest` if available (Python 3.11+) (Jake Howard) * API ordering now [supports multiple fields](api_v2_usage_ordering) (Rohit Sharma, Jake Howard) * Pass block value to `Block.get_template` to allow varying template based on value (Florian Delizy) * Add [`InlinePanel` DOM events](inline_panel_events) for when ready and when items added or removed (Faishal Manzar) * Support `Filter` instances as input for [`AbstractImage.get_renditions()`](image_renditions_multiple) (Thibaud Colas) * Improve error messages for image template tags (Thibaud Colas) ### Bug fixes * Ensure that StreamField's `FieldBlock`s correctly set the `required` and `aria-describedby` attributes (Storm Heg) * Avoid an error when the moderation panel (admin dashboard) contains both snippets and private pages (Matt Westcott) * When deleting collections, ensure the collection name is correctly shown in the success message (LB (Ben) Johnston) * Filter out comments on Page editing counts that do not correspond to a valid field / block path on the page such as when a field has been removed (Matt Westcott) * Allow `PublishMenuItem` to more easily support overriding its label via `construct_page_action_menu` (Sébastien Corbin) * Allow locale selection when creating a page at the root level (Sage Abdullah) * Ensure the admin login template correctly displays all `non_fields_errors` for any custom form validation (Sébastien Corbin) * Ensure 'mark as active' label in workflow bulk action set active form can be translated (Rohit Sharma) * Ensure the panel title for a user's settings correctly reflects the `WAGTAIL_EMAIL_MANAGEMENT_ENABLED` setting by not showing 'email' if disabled (Omkar Jadhav) * Update Spotify oEmbed provider URL parsing to resolve correctly (Dhrűv) * Update link colours within help blocks to meet accessible contrast requirements (Rohit Sharma) * Ensure the search promotions popular search terms picker correctly refers to the correct model (LB (Ben) Johnston) * Correctly quote non-numeric primary keys on snippet inspect view (Sage Abdullah) * Prevent crash on snippet inspect view when displaying a null foreign key to an image (Sage Abdullah) * Ensure that pages in moderation show as "Live + In Moderation" in the page explorer rather than "Live + Draft" (Sage Abdullah) * Prevent error when updating reference index for objects with a lazy ParentalKey-related object (Chris Shaw) * Ignore conflicts when inserting reference index entries to prevent race conditions causing uniqueness errors (Chris Shaw) * Populate the correct return value when creating a new snippet within the snippet chooser (claudobahn) * Reinstate missing filter by page type on page search (Matt Westcott) * Ensure very long words can wrap when viewing saved comments (Chiemezuo Akujobi) * Avoid forgotten password link text conflicting with the supplied aria-label (Thibaud Colas) * Fix log message to record the correct restriction type when removing a page view restriction (Rohit Sharma, Hazh. M. Adam) * Avoid potential race condition with new Page subscriptions on the edit view (Alex Tomkins) ### Documentation * Document `WAGTAILADMIN_BASE_URL` on "Integrating Wagtail into a Django project" page (Shreshth Srivastava) * Replace incorrect screenshot for authors listing on tutorial (Shreshth Srivastava) * Add documentation for building non-model-based choosers using the _queryish_ library (Matt Westcott) * Fix incorrect tag library import on focal points example (Hatim Makki Hoho) * Add reminder about including your custom Draftail feature in any overridden `WAGTAILADMIN_RICH_TEXT_EDITORS` setting (Charlie Sue) * Mention the need to install `python3-venv` on Ubuntu (Brian Mugo) * Document the use of the Google developer documentation style guide in documentation (Damilola Oladele) * Fix Inconsistent URL Format in Getting Started tutorial (Olumide Micheal) * Add more extensive documentation for the `permission` kwarg support in Panels (LB (Ben) Johnston) ### Maintenance * Fix snippet search test to work on non-fallback database backends (Matt Westcott) * Update Eslint, Prettier & Jest npm packages (LB (Ben) Johnston) * Add npm scripts for TypeScript checks and formatting SCSS files (LB (Ben) Johnston) * Run tests in parallel in some of the CI setup (Sage Abdullah) * Remove unused WorkflowStatus view, urlpattern, and workflow-status.js (Storm Heg) * Add support for options/attrs in Telepath widgets so that attrs render on the created DOM (Storm Heg) * Update pre-commit hooks to be in sync with latest changes to Eslint & Prettier for client-side changes (Storm Heg) * Add `WagtailTestUtils.get_soup()` method for testing HTML content (Storm Heg, Sage Abdullah) * Allow `ViewSet` subclasses to customise `url_prefix` and `url_namespace` logic (Matt Westcott) * Simplify `SnippetViewSet` registration code (Sage Abdullah) * Rename groups `IndexView.results_template_name` to `results.html` (Sage Abdullah) * Migrate form submission listing checkbox toggling to the shared `w-bulk` Stimulus implementation (LB (Ben) Johnston) * Allow viewsets to define a common set of view kwargs (Matt Westcott) * Migrate the editor unsaved messages popup to be driven by Stimulus using the shared `w-message` controller (LB (Ben) Johnston, Hussain Saherwala) * Do not use jest inside `stubs.js` to prevent Storybook from crashing (LB (Ben) Johnston) * Refactor snippets templates to reuse the shared `slim_header.html` template (Sage Abdullah) * Refactor `slim_header.html` template to reduce code duplication (Sage Abdullah) * Upgrade Willow to v1.6.2 to support MIME type data without reliance on `imghdr` (Jake Howard) * Replace `imghdr` with Willow's built-in MIME type detection (Jake Howard) * Migrate all other `data-tippy` HTML attribute usage to the Stimulus data-*-value attributes for w-tooltip & w-dropdown (Subhajit Ghosh, LB (Ben) Johnston) * Replace `@total_ordering` usage with comparison functions implementation (Virag Jain) * Replace ` {% endescapescript %} ``` #### New Use the HTML [`template`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) element to avoid content from being parsed by the browser on load. ```html+django ``` ### Adoption of `classname` convention within the Image `Format` instance When using `wagtail.images.formats.Format`, the created instance set the argument for classes to the attribute `classnames` (plural), this has now changed to `classname` (singular). For any custom code that accessed or modified this undocumented attribute, updates will need to be made as follows. Accessing `self.classnames` will still work until a future release, simply returning `self.classname`, but this will raise a deprecation warning. ```python # image_formats.py from django.utils.html import format_html from wagtail.images.formats import Format, register_image_format class CustomImageFormat(Format): def image_to_html(self, image, alt_text, extra_attributes=None): # contrived example - pull out the class and render on outside element classname = self.classname # not self.classnames self.classname = "" # not self.classnames inner_html = super().image_to_html(image, alt_text, extra_attributes) return format_html("{}", classname, inner_html) custom_format = CustomImageFormat('custom_example', 'Custom example', 'example-image object-fit', 'width-750') register_image_format(custom_format) ``` ### Changes to search promotions contrib module #### Deprecated `search_garbage_collect` management command has been removed In 5.0 the documentation advised that the `search_garbage_collect` command used to remove old stored search queries and daily hits has been moved to [`searchpromotions_garbage_collect`](searchpromotions_garbage_collect). The old command has now been fully removed and if called will throw an error. #### Changes to URL names and templates Some search promotions URLs and templates have now moved from the main admin search module into the search promotions module. | **Item** | **Old** | **New** | | -------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | | URL name | `wagtailsearch_admin:queries_chooser` | `wagtailsearchpromotions:chooser` | | URL name | `wagtailsearch_admin:queries_chooserresults` | `wagtailsearchpromotions:queries_chooserresults` | | Template | `wagtail/search/templates/wagtailsearch/queries/chooser/chooser.html` | `wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/queries/chooser/chooser.html` | | Template | `wagtail/search/templates/wagtailsearch/queries/chooser/results.html` | `wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/queries/chooser/results.html` | | Template | `wagtail/search/templates/wagtailsearch/queries/chooser_field.html` | `wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/queries/chooser_field.html` | ### `Block.get_template` now accepts a `value` argument The `get_template` method on StreamField blocks now accepts a `value` argument in addition to `context`. Code using the old signature should be updated: ```python # Old def get_template(self, context=None): ... # New def get_template(self, value=None, context=None): ... ```