5.9 KiB
Wagtail 4.0 release notes - IN DEVELOPMENT
---
local:
depth: 1
---
What's new
Other features
- Add clarity to confirmation when being asked to convert an external link to an internal one (Thijs Kramer)
- Convert various pages in the documentation to Markdown (Khanh Hoang, Vu Pham, Daniel Kirkham, LB (Ben) Johnston, Thiago Costa de Souza)
- Add
base_url_path
toModelAdmin
so that the default URL structure of app_label/model_name can be overridden (Vu Pham, Khanh Hoang) - Add
full_url
to the API output ofImageRenditionField
(Paarth Agarwal) - Use
InlinePanel
's label when available for field comparison label (Sandil Ranasinghe) - Drop support for Safari 13 by removing left/right positioning in favour of CSS logical properties (Thibaud Colas)
- Use
FormData
instead of jQuery'sform.serialize
when editing documents or images just added so that additional fields can be better supported (Stefan Hammer) - Add informational Codecov status checks for GitHub CI pipelines (Tom Hu)
- Make it possible to reuse and customise Wagtail’s fonts with CSS variables (LB (Ben) Johnston)
- Add better handling and informative developer errors for cross linking URLS (e.g. success after add) in generic views
wagtail.admin.views.generic
(Matt Westcott) - Introduce
wagtail.admin.widgets.chooser.BaseChooser
to make it easier to build custom chooser inputs (Matt Westcott) - Introduce JavaScript chooser module, including a SearchController class which encapsulates the standard pattern of re-rendering the results panel in response to search queries and pagination (Matt Westcott)
- Add ability to select multiple items at once within bulk actions selections when holding shift on subsequent clicks (Hitansh Shah)
- Upgrade notification, shown to admins on the dashboard if Wagtail is out of date, will now link to the release notes for the closest minor branch instead of the latest patch (Tibor Leupold)
- Upgrade notification can now be configured to only show updates when there is a new LTS available via
WAGTAIL_ENABLE_UPDATE_CHECK = 'lts'
(Tibor Leupold) - Implement redesign of the Workflow Status dialog, fixing accessibility issues (Steven Steinwand)
- Add the ability to change the number of images displayed per page in the image library (Tidiane Dia, with sponsorship from YouGov)
- Allow users to sort by different fields in the image library (Tidiane Dia, with sponsorship from YouGov)
Bug fixes
- Fix issue where
ModelAdmin
index listings with export list enabled would show buttons with an incorrect layout (Josh Woodcock) - Fix typo in
ResumeWorkflowActionFormatter
message (Stefan Hammer) - Throw a meaningful error when saving an image to an unrecognised image format (Christian Franke)
- Remove extra padding for headers with breadcrumbs on mobile viewport (Steven Steinwand)
- Replace
PageRevision
with genericRevision
model (Sage Abdullah) - Ensure the upgrade notification request for the latest release, which can be disabled via the
WAGTAIL_ENABLE_UPDATE_CHECK
sends the referrer origin withstrict-origin-when-cross-origin
(Karl Hobley) - Ensure radio buttons / checkboxes display vertically under Django 4.0 (Matt Westcott)
- Ensure that custom document or image models support custom tag models (Matt Westcott)
- Ensure comments use translated values for their placeholder text (Stefan Hammer)
- Ensure the upgrade notification, shown to admins on the dashboard if Wagtail is out of date, content is translatable (LB (Ben) Johnston)
Upgrade considerations
base_url_path
keyword argument added to AdminURLHelper
The wagtail.contrib.modeladmin.helpers.AdminURLHelper
class now accepts a base_url_path
keyword argument on its constructor. Custom subclasses of this class should be updated to accept this keyword argument.
Dropped support for Safari 13
Safari 13 will no longer be officially supported as of this release, this deviates the current support for the last 3 version of Safari by a few months and was required to add better support for RTL languages.
PageRevision
replaced with Revision
The PageRevision
model has been replaced with a generic Revision
model. If you use the PageRevision
model in your code, make sure that:
- Creation of
PageRevision
objects should be updated to createRevision
objects using the page'sid
as theobject_id
, the defaultPage
model's content type as thebase_content_type
, and the page's specific content type as thecontent_type
. - Queries that use the
PageRevision.objects
manager should be updated to use theRevision.page_revisions
manager. Revision
queries that usePage.id
should be updated to cast thePage.id
to a string before using it in the query (e.g. by usingstr()
orCast("page_id", output_field=CharField())
).Page
queries that usePageRevision.page_id
should be updated to cast theRevision.object_id
to an integer before using it in the query (e.g. by usingint()
orCast("object_id", output_field=IntegerField())
).- Access to
PageRevision.page
should be updated toRevision.content_object
.
If you maintain a package across multiple Wagtail versions that includes a model with a ForeignKey
to the PageRevision
model, you can create a helper function to correctly resolve the model depending on the installed Wagtail version, for example:
from django.db import models
from wagtail import VERSION as WAGTAIL_VERSION
def get_revision_model():
if WAGTAIL_VERSION >= (4, 0):
return "wagtailcore.Revision"
return "wagtailcore.PageRevision"
class MyModel(models.Model):
# Before
# revision = models.ForeignKey("wagtailcore.PageRevision")
revision = models.ForeignKey(get_revision_model(), on_delete=models.CASCADE)
AdminChooser
replaced with BaseChooser
Custom choosers should no longer use wagtail.admin.widgets.chooser.AdminChooser
which has been replaced with wagtail.admin.widgets.chooser.BaseChooser
.