Previously, the locale will be set even if the view doesn't set a model
attribute. This means that it will load the default locale or the locale
specified by the query param.
However, in practice, this mixin is typically used for views that work
with a translatable model.
Setting the locale when the view doesn't set a model will still cause a
query to get the locale. Since it's unlikely that the view actually
needs to work with a locale if it doesn't set a model, just drop the
support for it so we can eliminate that extra query.
The model_opts is already supplied by generic
IndexView.get_context_data(), and can_add_snippet is already covered by
the can_add context variable in the generic view. For the template, the
only differences are:
- the title tag no longer says 'Snippet <model name>' and instead only
says '<model name>'
- the body class for the model has been removed
The base_actions was added in 252c4015a0
for the sole purpose of fixing the position of the locale switcher on
snippets index view.
With the upcoming Universal Listings work, all of the actions and
filters will likely be moved to the slim header (breadcrumbs), so this
will be eliminated anyway. However, doing this allows us to refactor the
snippets index view to reuse as much of the generic index view code and
template as possible (see next commit).
Reduce template overrides and make it more consistent with the page
listing header, including using
PagePermissionTester.can_view_revisions() when rendering the link.
When the history button is turned into a proper side panel, we can
refactor this further.
The is_root check for the side panels is moved to the view code. For the
"Live" link, the check is already covered by the
page_status_tag_new.html template that checks for page.live and
page.url.
This allows the more "adventurous" to update their requirements so they
can install the next latest Django version (5.1 and 5.2) even if we
haven't officially supported it. As long as we're on top of Django's
updates, this should be OK for the duration of this Wagtail release's
active support period.
However, do not update the default project template's requirements yet,
since we don't want new projects to be installed with Django versions we
haven't officially supported.
- Set the side panel width custom property ('--side-panel-width') globally, not just on the form container.
- Use this custom property to determine the max width of the form content.
- Fixes#11038
However, keep the logic for falling back to extracting panel definitions
from the model class as snippets-specific. ModelViewSets are likely used
with models that are more low-level and thus we want developers to
explicitly define the fields that are editable in the admin, just like
how Django's ModelForm works.