Unreleased
---
local:
depth: 1
---
The built-in accessibility checker now enforces a new alt-text-quality
rule, which tests alt text for the presence of known bad patterns such as file extensions. This rule is enabled by default, but can be disabled if necessary.
This feature was implemented by Albina Starykova, with support from the Wagtail accessibility team.
HOSTNAMES
parameter on WAGTAILFRONTENDCACHE
to define which hostnames a backend should respond to (Jake Howard, sponsored by Oxfam America)EditView
and breadcrumbs (Rohit Sharma)ChooseParentView
if only one possible valid parent page availale (Matthias Brück)copy_for_translation_done
signal when a page is copied for translation (Arnar Tumi Þorsteinsson)deactivate()
method to ProgressController
(Alex Morega)ModelViewSet
(Sage Abdullah)WAGTAILIMAGES_CHOOSER_PAGE_SIZE
setting functional again (Rohit Sharma)richtext
template tag to convert lazy translation values (Benjamin Bach).ico
images (Julie Rymer)verbose_name
on TranslatableMixin.locale
so that it is translated when used as a label (Romein van Buren)wagtail_serve
view is on a non-root path (Sage Abdullah)for_instance
method to PageLogEntryManager
(Matt Westcott)restriction_type
field on PageViewRestriction (Shlomo Markowitz)Orderable
is not required for inline panels (Bojan Mihelac)prefers-reduced-motion
to the accessibility documentation (Roel Koper)DjangoJSONEncoder
instead of custom LazyStringEncoder
to serialize Draftail config (Sage Abdullah)WAGTAILIMAGES_CHOOSER_PAGE_SIZE
at runtime (Matt Westcott)client/scss
directory in Tailwind content config to speed up CSS compilation (Sage Abdullah)contrib.frontend_cache.backends
into dedicated sub-modules (Andy Babic)docs/autobuild.sh
script (Sævar Öfjörð Magnússon)urlparse
with urlsplit
to improve performance (Jake Howard)Previous versions allowed passing a dict for DISTRIBUTION_ID
within the WAGTAILFRONTENDCACHE
configuration for a CloudFront backend, to allow specifying different distribution IDs for different hostnames. This is now deprecated; instead, multiple distribution IDs should be defined as multiple backends, with a HOSTNAMES
parameter to define the hostnames associated with each one. For example, a configuration such as:
WAGTAILFRONTENDCACHE = {
'cloudfront': {
'BACKEND': 'wagtail.contrib.frontend_cache.backends.CloudfrontBackend',
'DISTRIBUTION_ID': {
'www.wagtail.org': 'your-distribution-id',
'www.madewithwagtail.org': 'other-distribution-id',
},
},
}
should now be rewritten as:
WAGTAILFRONTENDCACHE = {
'mainsite': {
'BACKEND': 'wagtail.contrib.frontend_cache.backends.CloudfrontBackend',
'DISTRIBUTION_ID': 'your-distribution-id',
'HOSTNAMES': ['www.wagtail.org'],
},
'madewithwagtail': {
'BACKEND': 'wagtail.contrib.frontend_cache.backends.CloudfrontBackend',
'DISTRIBUTION_ID': 'other-distribution-id',
'HOSTNAMES': ['www.madewithwagtail.org'],
},
}
ModelViewSet
and SnippetViewSet
Models registered with a ModelViewSet
will now automatically have their {class}~django.contrib.auth.models.Permission
objects registered in the Groups administration area. Previously, you need to use the register_permissions
hook to register them.
If you have a model registered with a ModelViewSet
and you registered the model's permissions using the register_permissions
hook, you can now safely remove the hook.
If the viewset has {attr}~wagtail.admin.viewsets.model.ModelViewSet.inspect_view_enabled
set to True
, all permissions for the model are registered. Otherwise, the "view" permission is excluded from the registration.
To customize which permissions get registered for the model, you can override the {meth}~wagtail.admin.viewsets.model.ModelViewSet.get_permissions_to_register
method.
This behavior now applies to snippets as well. Previously, the "view" permission for snippets is always registered regardless of inspect_view_enabled
. If you wish to register the "view" permission, you can enable the inspect view:
class FooViewSet(SnippetViewSet):
...
inspect_view_enabled = True
Alternatively, if you wish to register the "view" permission without enabling the inspect view (i.e. the previous behavior), you can override get_permissions_to_register
like the following:
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
class FooViewSet(SnippetViewSet):
def get_permissions_to_register(self):
content_type = ContentType.objects.get_for_model(self.model)
return Permission.objects.filter(content_type=content_type)
The report views have been reimplemented to use the new Universal Listings UI, which introduces AJAX-based filtering and support for the wagtail.admin.ui.tables
framework.
As a result, a number of changes have been made to the ReportView
and PageReportView
classes, as well as their templates.
If you have custom report views as documented in [](adding_reports), you will need to make the following changes.
title
to page_title
The title
attribute on the view class should be renamed to page_title
:
class UnpublishedChangesReportView(PageReportView):
- title = "Pages with unpublished changes"
+ page_title = "Pages with unpublished changes"
Set the index_url_name
and index_results_url_name
attributes on the view class:
class UnpublishedChangesReportView(PageReportView):
+ index_url_name = "unpublished_changes_report"
+ index_results_url_name = "unpublished_changes_report_results"
and register the results-only view:
@hooks.register("register_admin_urls")
def register_unpublished_changes_report_url():
return [
path("reports/unpublished-changes/", UnpublishedChangesReportView.as_view(), name="unpublished_changes_report"),
+ # Add a results-only view to add support for AJAX-based filtering
+ path("reports/unpublished-changes/results/", UnpublishedChangesReportView.as_view(results_only=True), name="unpublished_changes_report_results"),
]
If you are only extending the templates to add your own markup for the listing table, you need to change the template_name
into results_template_name
on the view class.
class UnpublishedChangesReportView(PageReportView):
- template_name = "reports/unpublished_changes_report.html"
+ results_template_name = "reports/unpublished_changes_report_results.html"
After renaming the template (e.g. reports/unpublished_changes_report.html
to reports/unpublished_changes_report_results.html
), you will need to make a few changes to the template's contents:
wagtailadmin/reports/base_page_report_results.html
.The listing
and no_results
blocks should be renamed to results
and no_results_message
, respectively.
{# <project>/templates/reports/unpublished_changes_report_results.html #}
-{% extends "wagtailadmin/reports/base_page_report.html" %}
+{% extends "wagtailadmin/reports/base_page_report_results.html" %}
-{% block listing %}
+{% block results %}
{% include "reports/include/_list_unpublished_changes.html" %}
{% endblock %}
-{% block no_results %}
+{% block no_results_message %}
<p>No pages with unpublished changes.</p>
{% endblock %}
If you need to completely customize the view's template, you can still override the template_name
attribute on the view class. Note that both ReportView
and PageReportView
now use the wagtailadmin/reports/base_report.html
template, which now extends the wagtailadmin/generic/listing.html
template. The wagtailadmin/reports/base_page_report.html
template is now unused and should be replaced with wagtailadmin/reports/base_report.html
.