0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00
wagtail/docs/releases/5.1.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

488 lines
27 KiB
Markdown
Raw Normal View History

2023-04-21 13:28:31 +02:00
# Wagtail 5.1 release notes - IN DEVELOPMENT
_Unreleased_
```{contents}
---
local:
depth: 1
---
```
## What's new
### Read-only panels
FieldPanels can now be marked as read-only with the `read_only=True` keyword argument, so that they are displayed in the admin but cannot be edited. This feature was developed by Andy Babic.
2023-04-21 13:28:31 +02:00
### Wagtail tutorial improvements
As part of Google Season of Docs 2023, we worked with technical writer Damilola Oladele to make improvements to Wagtails "Getting started" tutorial. Here are the specific changes made as part of this project:
* Revamp the start of the getting started section, with separate quick install page
* Move the tutorials snippets section to come before tags
* Rewrite the getting started tutorial to address identified friction points
* Switch the Getting started tutorials snippets example to be more understandable
Thank you to Damilola for his work, and to Google for sponsoring this project.
### Custom template support for `wagtail start`
The `wagtail start` command now supports an optional `--template` argument that allows you to specify a custom project template to use. This is useful if you want to use a custom template that includes additional features or customisations. For more details, see [the project template reference](/reference/project_template). This feature was developed by Thibaud Colas.
### Search query boosting on Elasticsearch 6 and above
The `boost` option on `SearchField`, to increase the ranking of search results that match on the specified field, is now respected by Elasticsearch 6 and above. This was previously only supported up to Elasticsearch 5, due to a change in Elasticsearch's API. This feature was developed by Shohan Dutta Roy.
### Elasticsearch 8 support
This release adds support for Elasticsearch 8. This can be set up by installing a version 8.x release of the `elasticsearch` Python package, and setting `wagtail.search.backends.elasticsearch8` as the search backend. Compatibility updates were contributed by Matt Westcott and Wesley van Lee.
### Extend Stimulus adoption
2023-07-13 20:41:13 +02:00
As part of tackling Wagtails technical debt and improving [CSP compatibility](https://github.com/wagtail/wagtail/issues/1288), we have continued extending our usage of Stimulus, based on the plans laid out in [RFC 78: Adopt Stimulus](https://github.com/wagtail/rfcs/pull/78).
* Add support for `attrs` on `FieldPanel` and other panels to aid in custom Stimulus usage (Aman Pandey, Antoni Martyniuk, LB (Ben) Johnston)
* Migrate Tagit initialisation to a Stimulus Controller (LB (Ben) Johnston)
* Migrate legacy dropdown implementation to a Stimulus controller (Thibaud Colas)
2023-07-17 22:39:10 +02:00
* Migrate async header search and search with the Task chooser modal to `w-swap`, a Stimulus controller (LB (Ben) Johnston)
* Replace Bootstrap tooltips with a new `w-tooltip` Stimulus controller (LB (Ben) Johnston)
* Migrate dialog instantiation to a new `w-dialog` Stimulus controller (Loveth Omokaro, LB (Ben) Johnston)
* Support dialog template cloning using a new `w-teleport` Stimulus controller (Loveth Omokaro, LB (Ben) Johnston)
2023-07-13 20:41:13 +02:00
### AVIF image support
Wagtail now supports [AVIF](https://en.wikipedia.org/wiki/AVIF), a modern image format. We encourage all site implementers to consider using it to improve the performance of the sites and reduce their carbon footprint. For further details, see [image file format](image_file_formats), [output image format](output_image_format) and [image quality](image_quality).
This feature was developed by Aman Pandey 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 Braghis, Thibaud Colas, Sage Abdullah, Arne Tarara (Green Coding Berlin), and Chris Adams (Green Web Foundation).
2023-04-21 13:28:31 +02:00
### Other features
* Mark calls to `md5` as not being used for secure purposes, to avoid flagging on FIPS-mode systems (Sean Kelly)
* Return filters from `parse_query_string` as a `QueryDict` to support multiple values (Aman Pandey)
* Explicitly specify `MenuItem.name` for all admin menu and submenu items (Justin Koestinger)
* Add oEmbed provider patterns for YouTube Shorts (e.g. [https://www.youtube.com/shorts/nX84KctJtG0](https://www.youtube.com/shorts/nX84KctJtG0)) and YouTube Live URLs (valnuro, Fabien Le Frapper)
2023-06-16 12:44:44 +02:00
* Add initial implementation of `PagePermissionPolicy` (Sage Abdullah)
2023-06-27 19:35:16 +02:00
* Refactor `UserPagePermissionsProxy` and `PagePermissionTester` to use `PagePermissionPolicy` (Sage Abdullah, Tidiane Dia)
* Add a predictable default ordering of the "Object/Other permissions" in the Group Editing view, allow this [ordering to be customised](customising_group_views_permissions_order) (Daniel Kirkham)
2023-06-26 15:03:08 +02:00
* Implement a new design for chooser buttons with better accessibility (Thibaud Colas)
2023-06-29 17:38:26 +02:00
* Add [`AbstractImage.get_renditions()`](image_renditions_multiple) for efficient generation of multiple renditions (Andy Babic)
* Optimise queries in collection permission policies using cache on the user object (Sage Abdullah)
* Phone numbers entered via a link chooser will now have any spaces stripped out, ensuring a valid `href="tel:..."` attribute (Sahil Jangra)
* Auto-select the `StreamField` block when only one block type is declared (Sébastien Corbin)
* Add support for more [advanced Draftail customisation APIs](extending_the_draftail_editor_advanced) (Thibaud Colas)
2023-07-12 10:21:12 +02:00
* Add the ability to export snippets listing via `SnippetViewSet.list_export` (Sage Abdullah)
* Add support for adding [HTML `attrs`](panels_attrs) on `FieldPanel`, `FieldRowPanel`, `MultiFieldPanel`, and others (Aman Pandey, Antoni Martyniuk, LB (Ben) Johnston)
2023-07-12 17:59:08 +02:00
* Change to always cache renditions (Jake Howard)
* Update link/document rich text tooltips for consistency with the inline toolbar (Albina Starykova)
* Increase the contrast between the rich text / StreamField block picker and the page in dark mode (Albina Starykova)
2023-07-14 11:20:45 +02:00
* Purge revisions of non-page models in `purge_revisions` command (Sage Abdullah)
2023-07-13 20:41:13 +02:00
* Change the default WebP quality to 80 to match AVIF (Aman Pandey)
* Adopt optimised Wagtail logo in the admin interface (Albina Starykova)
* Add support for presenting the userbar (Wagtail button) in dark mode (Albina Starykova)
* Add Inspect view to snippets (Sage Abdullah)
2023-04-21 13:28:31 +02:00
### Bug fixes
* Prevent choosers from failing when initial value is an unrecognised ID such as when moving a page from a location where `parent_page_types` would disallow it (Dan Braghis)
2023-05-22 12:00:21 +02:00
* Move comment notifications toggle to the comments side panel (Sage Abdullah)
2023-05-23 09:22:21 +02:00
* Remove comment button on InlinePanel fields (Sage Abdullah)
* Fix missing link to `UsageView` from `EditView` for snippets (Christer Jensen)
* Prevent lowercase conversions of IndexView column headers (Virag Jain)
* Ensure that `RichText` objects with the same values compare as equal (NikilTn)
* Use `gettext_lazy` on generic model views so that language settings are correctly used (Matt Westcott)
2023-06-13 14:05:51 +02:00
* Prevent JS error when reverting the spinner on a submit button after a validation error (LB (Ben) Johnston)
* Prevent crash when comparing page revisions that include `MultipleChooserPanel` (Matt Westcott)
2023-06-14 19:51:08 +02:00
* Ensure that title and slug continue syncing after entering non-URL-safe characters (LB (Ben) Johnston)
2023-06-15 13:15:18 +02:00
* Ensure that title and slug are synced on keypress, not just on blur (LB (Ben) Johnston)
* Add a more visible active state for side panel toggle buttons (Thibaud Colas)
2023-06-21 23:59:20 +02:00
* Debounce and optimise live preview panel to prevent excessive requests (Sage Abdullah)
2023-06-26 15:03:08 +02:00
* Page listings actions under the "More" dropdown are now accessible for screen reader and keyboard users (Thibaud Colas)
* Bulk actions under the "More" dropdown are now accessible for screen reader and keyboard users (Thibaud Colas)
* Navigation to translations via the locale dropdown is now accessible for screen reader and keyboard users (Thibaud Colas)
* Make it possible for speech recognition users to reveal chooser buttons (Thibaud Colas)
* Use constant-time comparison for image serve URL signatures (Jake Howard)
* Ensure taggit field type-ahead options show correctly in the dark mode theme (Sage Abdullah)
2023-06-23 10:48:38 +02:00
* Fix the lock description message missing the model_name variable when locked only by system (Sébastien Corbin)
* Fix empty blocks created in migration operations (Sandil Ranasinghe)
* Ensure that `gettext_lazy` works correctly when using `verbose_name` on a generic Settings models (Sébastien Corbin)
* Remove unnecessary usage of `innerHTML` when modifying DOM content (LB (Ben) Johnston)
* Avoid `ValueError` when extending `PagesAPIViewSet` and setting `meta_fields` to an empty list (Henry Harutyunyan, Alex Morega)
* Improve accessibility for header search, remove autofocus on page load, advise screen readers that content has changed when results update (LB (Ben) Johnston)
* Fix incorrect override of `PagePermissionHelper.user_can_unpublish_obj()` in ModelAdmin (Sébastien Corbin)
* Prevent memory exhaustion when updating a large number of image renditions (Jake Howard)
* Add missing Time Zone conversions and date formatting throughout the admin (Stefan Hammer)
* Ensure that audit logs and revisions are consistently use UTC and add migration for existing entries (Stefan Hammer)
* Make sure "critical" buttons have enough color contrast in dark mode (Albina Starykova)
2023-07-14 16:24:28 +02:00
* Improve visibility of scheduled publishing errors in status side panel (Sage Abdullah)
2023-07-17 17:50:54 +02:00
* Prevent 'choose' permission from being ignored when looking up 'choose', 'edit' and 'delete' permissions in combination (Sage Abdullah)
* Take user's permissions into account for image / document counts on the admin dashboard (Sage Abdullah)
2023-05-24 18:11:56 +02:00
* Avoid N+1 queries in users index view (Tidiane Dia)
2023-04-21 13:28:31 +02:00
### Documentation
* Document how to add non-ModelAdmin views to a `ModelAdminGroup` (Onno Timmerman)
* Document how to add StructBlock data to a StreamField (Ramon Wenger)
2023-05-08 23:30:08 +02:00
* Update ReadTheDocs settings to v2 to resolve urllib3 issue in linkcheck extension (Thibaud Colas)
* Update documentation for `log_action` parameter on `RevisionMixin.save_revision` (Christer Jensen)
2023-05-24 12:07:50 +02:00
* Reorganise snippets documentation to cover customisations and optional features (Sage Abdullah)
2023-06-12 11:54:51 +02:00
* Update color customisations guidance to include theme-agnostic options (Thibaud Colas)
* Mark LTS releases in release note page titles (Thiago C. S. Tioma)
* Revise main Getting started tutorial for clarity (Kevin Chung (kev-odin))
* Update the [deployment documentation](deployment_guide) page and remove outdated information (Jake Howard)
* Add more items to performance page regarding pre-fetching images and frontend caching (Jake Howard)
2023-04-21 13:28:31 +02:00
### Maintenance
* Removed support for Python 3.7 (Dan Braghis)
2023-04-21 13:28:31 +02:00
* Switch to ruff for flake8 / isort code checking (Oliver Parker)
* Deprecate `insert_editor_css` in favour of `insert_global_admin_css` (Ester Beltrami)
2023-06-07 16:51:24 +02:00
* Optimise use of `specific` on Task and TaskState (Matt Westcott)
* Use table UI component for workflow task index view (Matt Westcott)
2023-06-09 15:18:10 +02:00
* Make header search available on generic index view (Matt Westcott)
2023-06-10 14:09:33 +02:00
* Update pagination behaviour to reject out-of-range / invalid page numbers (Matt Westcott)
2023-06-12 11:54:51 +02:00
* Remove color tokens which are duplicates / unused (Thibaud Colas)
* Add tests to help with maintenance of theme color tokens (Thibaud Colas)
2023-06-13 11:58:50 +02:00
* Split out a base listing view from generic index view (Matt Westcott)
* Update type hints in admin/ui/components.py so that `parent_context` is mutable (Andreas Nüßlein)
2023-06-19 16:29:30 +02:00
* Deprecate `UserPagePermissionsProxy` (Sage Abdullah)
* Optimise the Settings context processor to avoid redundantly finding a Site to improve cache ratios (Jake Howard)
2023-06-26 12:15:40 +02:00
* Convert page listing to a class-based view (Matt Westcott)
* Clean up page reports and type usage views to be independent of page listing views (Matt Westcott)
2023-06-26 15:03:08 +02:00
* Refactor "More" dropdowns, locale selector, "Switch locales", page actions, to use the same dropdown component (Thibaud Colas)
2023-06-27 20:00:41 +02:00
* Refactor GroupPagePermission to use Django's Permission model (Sage Abdullah)
2023-06-29 09:50:42 +02:00
* Convert the `CONTRIBUTORS` file to Markdown (Dan Braghis)
2023-07-06 08:53:46 +02:00
* Move `django-filter` version upper bound to v24 (Yuekui)
* Update Pillow dependency to allow 10.x, only include support for >= 9.1.0 (Yuekui)
2023-07-13 01:42:38 +02:00
* Replace ModelAdmin history header human readable date template tag (LB (Ben) Johnston)
2023-07-13 08:45:24 +02:00
* Update uuid to v9 and Jest to v29, with `jest-environment-jsdom` and new snapshot format (LB (Ben) Johnston)
* Update test cases producing undesirable console output due to missing mocks, uncaught errors, warnings (LB (Ben) Johnston)
* Remove unused snippets _header_with_history.html template (Thibaud Colas)
* Migrate away from using the `"wagtailadmin/shared/field_as_li.html"` template include (Storm Heg)
2023-04-21 13:28:31 +02:00
## Upgrade considerations
### Removed support for Python 3.7
Python 3.7 is no longer supported as of this release; please upgrade to Python 3.8 or above before upgrading Wagtail.
### Pillow dependency update
Wagtail no longer supports Pillow versions below `9.1.0`.
### Elasticsearch 5 and 6 backends are deprecated
The Elasticsearch 5 and 6 search backends are deprecated and will be removed in a future release; please upgrade to Elasticsearch 7 or above.
### `insert_editor_css` hook is deprecated
The `insert_editor_css` hook has been deprecated. The `insert_global_admin_css` hook has the same functionality, and all uses of `insert_editor_css` should be changed to `insert_global_admin_css`.
2023-06-14 13:18:56 +02:00
### `UserPagePermissionsProxy` is deprecated
The undocumented `wagtail.models.UserPagePermissionsProxy` class is deprecated.
If you use the `.for_page(page)` method of the class to get a `PagePermissionTester` instance, you can replace it with `page.permissions_for_user(user)`.
If you use the other methods, they can be replaced via the `wagtail.permission_policies.pages.PagePermissionPolicy` class. The following is a list of the `PagePermissionPolicy` equivalent of each method:
```python
from wagtail.models import UserPagePermissionsProxy
from wagtail.permission_policies.pages import PagePermissionPolicy
# proxy = UserPagePermissionsProxy(user)
permission_policy = PagePermissionPolicy()
# proxy.revisions_for_moderation()
permission_policy.revisions_for_moderation(user)
# proxy.explorable_pages()
permission_policy.explorable_instances(user)
# proxy.editable_pages()
permission_policy.instances_user_has_permission_for(user, "change")
2023-06-14 13:18:56 +02:00
# proxy.can_edit_pages()
permission_policy.instances_user_has_permission_for(user, "change").exists()
2023-06-14 13:18:56 +02:00
# proxy.publishable_pages()
permission_policy.instances_user_has_permission_for(user, "publish")
# proxy.can_publish_pages()
permission_policy.instances_user_has_permission_for(user, "publish").exists()
# proxy.can_remove_locks()
permission_policy.user_has_permission(user, "unlock")
2023-06-14 13:18:56 +02:00
```
The `UserPagePermissionsProxy` object that is available in page's `ActionMenuItem` context as `user_page_permissions` (which might be used as part of a `register_page_action_menu_item` hook) has been deprecated. In cases where the page object is available (e.g. the page edit view), the `PagePermissionTester` object stored as the `user_page_permissions_tester` context variable can still be used.
2023-06-14 13:18:56 +02:00
The `UserPagePermissionsProxy` object that is available in the template context as `user_page_permissions` as a side-effect of the `page_permissions` template tag has also been deprecated.
If you use the `user_page_permissions` context variable or use the `UserPagePermissionsProxy` class directly, make sure to replace it either with the `PagePermissionTester` or the `PagePermissionPolicy` equivalent.
### `get_pages_with_direct_explore_permission`, `get_explorable_root_page`, and `users_with_page_permission` are deprecated
The undocumented `get_pages_with_direct_explore_permission` and `get_explorable_root_page` functions in `wagtail.admin.navigation` are deprecated. They can be replaced with `PagePermissionPolicy().instances_with_direct_explore_permission(user)` and `PagePermissionPolicy().explorable_root_instance(user)`, respectively.
The undocumented `users_with_page_permission` function in `wagtail.admin.auth` is also deprecated. It can be replaced with `PagePermissionPolicy().users_with_permission_for_instance(action, page, include_superusers)`.
### `GroupPagePermission` now uses Django's `Permission` model
The `GroupPagePermission` model that is responsible for assigning page permissions to groups now uses Django's `Permission` model instead of a custom string. This means that the `permission_type` `CharField` has been deprecated and replaced with a `permission` `ForeignKey` to the `Permission` model.
In addition to this, "edit" permissions now use the term `change` within the code. As a result, `GroupPagePermission`s that were previously recorded with `permission_type="edit"` are now recorded with a `Permission` object that has the `codename="change_page"` and a `content_type` that points to the `Page` model. Any permission checks that are done using `PagePermissionPolicy` should also use `change` instead of `edit`.
If you have any fixtures for the `GroupPagePermission` model, you will need to update them to use the new `Permission` model. For example, if you have a fixture that looks like this:
```json
{
"pk": 11,
"model": "wagtailcore.grouppagepermission",
"fields": {
"group": ["Event moderators"],
"page": 12,
"permission_type": "edit"
}
}
```
Update it to use a natural key for the `permission` field instead of the `permission_type` field:
```json
{
"pk": 11,
"model": "wagtailcore.grouppagepermission",
"fields": {
"group": ["Event moderators"],
"page": 12,
"permission": ["change_page", "wagtailcore", "page"]
}
}
```
If you have any code that creates `GroupPagePermission` objects, you will need to update it to use the `Permission` model instead of the `permission_type` string. For example, if you have code that looks like this:
```python
from wagtail.core.models import GroupPagePermission
permission = GroupPagePermission(group=group, page=page, permission_type="edit")
permission.save()
```
Update it to use the `Permission` model instead:
```python
from django.contrib.auth.models import Permission
from wagtail.core.models import GroupPagePermission
permission = GroupPagePermission(
group=group,
page=page,
permission=Permission.objects.get(content_type__app_label="wagtailcore", codename="change_page"),
)
permission.save()
```
During the deprecation period, the `permission_type` field will still be available on the `GroupPagePermission` model and is used to automatically populate empty `permission` field as part of a system check. The `permission_type` field will be removed in Wagtail 6.0.
### The default ordering of Group Editing Permissions models has changed
The ordering for "Object permissions" and "Other permissions" now follows a predictable order equivalent to Django's default `Model` ordering.
This will be different to the previous ordering which never intentionally implemented.
The default ordering is now `["content_type__app_label", "content_type__model"]`, which can now be customised [](customising_group_views_permissions_order).
### Shared include `wagtailadmin/shared/last_updated.html` is no longer available
The undocumented shared include `wagtailadmin/shared/last_updated.html` is no longer available as it used the legacy Bootstrap tooltips and was not accessible. If you need to achieve a similar output, an element that shows a simple date with a tooltip for the full date, use the `human_readable_date` template tag instead.
#### Before
```html+django
{% include "wagtailadmin/shared/last_updated.html" with last_updated=my_model.timestamp %}
```
#### After
```html+django
{% load wagtailadmin_tags %}
<!-- ... -->
{% human_readable_date my_model.timestamp %}
```
### Shared include `field_as_li.html` will be removed
The documented include `"wagtailadmin/shared/field_as_li.html"` will be removed in a future release, if being used it will need to be replaced with `"wagtailadmin/shared/field.html"` wrapped within `li` tags.
#### Before
```html+django
{% include "wagtailadmin/shared/field_as_li.html" %}
```
#### After
```html+django
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
```
### Tag (Tagit) field usage now relies on data attributes
The `AdminTagWidget` widget has now been migrated to a Stimulus controller, if using this widget in Python, no changes are needed to adopt the new approach.
If the widget is being instantiated in JavaScript or HTML with the global util `window.initTagField`, this undocumented util should be replaced with the new `data-*` attributes approach. Additionally, any direct usage of the jQuery widget in JavaScript (e.g. `$('#my-element).tagit()`) should be removed.
The global util will be removed in a future release. It is recommended that the documented `AdminTagWidget` be used. However, if you need to use the JavaScript approach you can do this with the following example.
#### Old syntax
```html
<input id="id_tags" type="text" value="popular, technology" hidden />
<script>
window.initTagField('id_tags', 'path/to/url', { autocompleteOnly: true });
</script>
```
#### New syntax
```html
<input
id="id_tags"
type="text"
value="popular, technology"
hidden
data-controller="w-tag"
data-w-tag-options-value='{"autocompleteOnly": true}'
data-w-tag-url-value="/path/to/url"
/>
```
Note: The `data-w-tag-options-value` is a JSON object serialised into string. Django's HTML escaping will handle it automatically when you use the `AdminTagWidget`, but if you are manually writing the attributes, be sure to use quotation marks correctly.
2023-07-12 17:59:08 +02:00
### Image Renditions are now cached by default
Wagtail will try to use the cache called "renditions". If no such cache exists, it will fall back to using the default cache.
2023-07-14 11:20:45 +02:00
You can [configure the "renditions" cache](custom_image_renditions_cache) to use a different cache backend or to provide
2023-07-12 17:59:08 +02:00
additional configuration parameters.
### Tooltips now rely on new data attributes
The undocumented Bootstrap jQuery tooltip widget is no longer in use, you will need to update any HTML that is using these attributes to the new syntax.
```html
<!-- Old attributes: -->
<span data-wagtail-tooltip="Tooltip content here">Label</span>
<!-- New attributes: -->
<span data-controller="w-tooltip" data-w-tooltip-content-value="Tooltip content here">Label</span>
```
### Dialog hide/show custom events name change
The undocumented client-side Custom Event handling for dialog showing & hiding will change in a future release.
| Action | Old event | New event |
| ------ | -------------- | --------------- |
| Show | `wagtail:show` | `w-dialog:show` |
| Hide | `wagtail:hide` | `w-dialog:hide` |
Additionally, two new events will be dispatched when the dialog visibility changes.
| Action | Event name |
| ------ | ----------------- |
| Show | `w-dialog:shown` |
| Hide | `w-dialog:hidden` |
### JSON-timestamps stored in `ModelLogEntry` and `PageLogEntry` are now ISO-formatted and UTC
Previously, timestamps stored in the "data"-`JSONField` of `ModelLogEntry` and `PageLogEntry` have used the custom python format `%d %b %Y %H:%M`. Additionally, the `"go_live_at"` timestamp had been stored with the configured local timezone, instead of UTC.
This has now been fixed, all timestamps are now stored as UTC, and because the "data"-`JSONField` now uses Django's `DjangoJSONEncoder`, those `datetime` objects are now automatically converted to the ISO format. This release contains a new migration `0088_fix_log_entry_json_timestamps` which converts all existing timestamps used by Wagtail to the new format.
If you've developed your own subclasses of `ModelLogEntry`, `PageLogEntry` or `BaseLogEntry`, or used those existing models to create custom log entries, and you've stored timestamps similarly to Wagtail's old implementation (using `strftime("%d %b %Y %H:%M")`). You may want to adapt the storage of those timestamps to a consistent format too.
There are probably three places in your code, which have to be changed:
1. Creation: Instead of using `strftime("%d %b %Y %H:%M")`, you can now store the datetime directly in the "data" field. We've implemented a new helper `wagtail.utils.timestamps.ensure_utc()`, which ensures the correct timezone (UTC).
2. Display: To display the timestamp in the user's timezone and format with a `LogFormatter`, we've created utils to parse (`wagtail.utils.timestamps.parse_datetime_localized()`) and render (`wagtail.utils.timestamps.render_timestamp()`) those timestamps. Look at the existing formatters [here](https://github.com/wagtail/wagtail/blob/main/wagtail/wagtail_hooks.py).
3. Migration: You can use the code of the above migration ([source](https://github.com/wagtail/wagtail/blob/main/wagtail/migrations/0088_fix_log_entry_json_timestamps.py)) as a guideline to migrate your existing timestamps in the database.
### Header searching now relies on data attributes
Previously the header search relied on inline scripts and a `window.headerSearch` global to activate the behaviour. This has now changed to a data attributes approach and the window global usage will be removed in a future major release.
If you are using the documented Wagtail [viewsets](viewsets_reference), Snippets or `ModelAdmin` approaches to building custom admin views, there should be no change required.
If you are using the shared header template include for a custom search integration, here's how to adopt the new approach.
#### Header include before
```html+django
{% extends "wagtailadmin/base.html" %}
{% load wagtailadmin_tags %}
{% block extra_js %}
{{ block.super }}
<script>
window.headerSearch = {
url: "{% url 'myapp:search_results' %}",
termInput: '#id_q',
targetOutput: '#my-results',
};
</script>
{% endblock %}
{% block content %}
{% include "wagtailadmin/shared/header.html" with title="my title" search_url="myapp:index" %}
... other content
{% endblock %}
```
#### Header include after
Note: No need for `extra_js` usage at all.
```html+django
{% extends "wagtailadmin/base.html" %}
{% load wagtailadmin_tags %}
{% block content %}
{% url 'myapp:search_results' as search_results_url %}
{% include "wagtailadmin/shared/header.html" with title="my title" search_url="myapp:index" search_results_url=search_results_url search_target="#my-results" %}
... other content
{% endblock %}
```
Alternatively, if you have customisations that manually declare or override `window.headerSearch`, here's how to adopt the new approach.
#### Manual usage before
```html
<script>
window.headerSearch = {
url: '{{ my_async_results_url }}',
termInput: '#id_q',
targetOutput: '#some-results',
};
</script>
<form role="search">
<input type="text" name="q" id="id_q" />
</form>
<div id="some-results"></div>
```
#### Manual usage after
```html
<form
role="search"
data-controller="w-swap"
data-action="change->w-swap#searchLazy input->w-swap#searchLazy"
data-w-swap-src-value="{{ my_async_results_url }}"
data-w-swap-target-value="#some-results"
>
<input type="text" name="q" data-w-swap-target="input" id="id_q" data-w-swap-target="input" />
</form>
<div id="some-results"></div>
```