0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00
wagtail/docs/releases/5.1.md

6.1 KiB

Wagtail 5.1 release notes - IN DEVELOPMENT

Unreleased

---
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.

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 Embed URL provider support YouTube Shorts (e.g. https://www.youtube.com/shorts/nX84KctJtG0) (valnuro)
  • Add initial implementation of PagePermissionPolicy (Sage Abdullah)

Bug fixes

  • Prevent choosers from failing when initial value is an unrecognised ID, e.g. when moving a page from a location where parent_page_types would disallow it (Dan Braghis)
  • Move comment notifications toggle to the comments side panel (Sage Abdullah)
  • 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)
  • 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)
  • Ensure that title and slug continue syncing after entering non-URL-safe characters (LB (Ben) Johnston)
  • 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)

Documentation

  • Document how to add non-ModelAdmin views to a ModelAdminGroup (Onno Timmerman)
  • Document how to add StructBlock data to a StreamField (Ramon Wenger)
  • 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)
  • Reorganise snippets documentation to cover customisations and optional features (Sage Abdullah)
  • 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))

Maintenance

  • Switch to ruff for flake8 / isort code checking (Oliver Parker)
  • Deprecate insert_editor_css in favour of insert_global_admin_css (Ester Beltrami)
  • Optimise use of specific on Task and TaskState (Matt Westcott)
  • Use table UI component for workflow task index view (Matt Westcott)
  • Make header search available on generic index view (Matt Westcott)
  • Update pagination behaviour to reject out-of-range / invalid page numbers (Matt Westcott)
  • Remove color tokens which are duplicates / unused (Thibaud Colas)
  • Add tests to help with maintenance of theme color tokens (Thibaud Colas)
  • 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)

Upgrade considerations

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.

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:

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, "edit")

# proxy.can_edit_pages()
permission_policy.instances_user_has_permission_for(user, "edit").exists()

# 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_any_permission(user, "unlock")

The UserPagePermissionsProxy object that was previously available in page's ActionMenuItem context as user_page_permissions has been removed. 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 is still available.

If you use UserPagePermissionsProxy in your code, e.g. the user_page_permissions context variable in an ActionMenuItem subclass as part of your register_page_action_menu_item hooks, make sure to replace it either with the PagePermissionTester or the PagePermissionPolicy equivalent.

get_pages_with_direct_explore_permission and get_explorable_root_page 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.