There is no reason to not check for the collections in the search results view as well.
In fact, the inconsistency before this change caused an issue where the
collections column will be shown on first load, but when a search is
performed (or cleared) the column will never be shown again.
Meanwhile, the current_collection is already set in BaseListingView anyway,
so it makes sense to put it in the context from there.
This has been around since the start (see
cba8f851d7/wagtail/wagtaildocs/views/documents.py)
However, its use in the template was removed in
c73d5c6ecc and was never restored.
Even when it was still in place, it wasn't implemented as a proper
filter. Instead, it was treated as a search query string.
For images, this was restored in
233e7f5189 with actual database-level
filtering.
This defers the instantiation of the columns at the point when they're needed instead of very early on in the view, when other variables needed may not be available yet
This also reduces the divergence between the BaseListingView and the IndexView
This documentation change clarifies that MultipleChooserPanel can only
be used when the inline model has a ForeignKey to a model that
implements Wagtail's chooser interface. Currently the docs mention
"a chooser for a ForeignKey relation" but it's not obvious how that
restricts which models can be pointed to or how to implement this for a
non-(image, document, snippet, page) model.
Relates to #10646.
It is only shown for screen readers, which is inconsistent with the actual visible text.
It also makes the captions unnecessarily verbose, as the dimensions info is not very useful in the image listings
To safely handle non-integer primary keys. This is mostly useful for
snippets, but do it everywhere for consistency and in case of custom
document and image models.
If the aria-label is too specific, e.g. 'Select page', 'Select document'
(and in the case of images it's 'Select image <image title> <image
dimensions>), it is hard for voice control users to click on the
checkbox because they have to specify the full label.
Instead, enforce a simple 'Select' aria-label and use aria-describedby
to describe the checkbox by referring to the title in the title column.
This ensures that people upgrading to Django 5.0 will have a compatible version. Now that Python <3.8 and Django <3.2 are EOL, there's no reason for anyone to be running an older version.
At this point wagtailadmin/shared/field.html is still used by FieldPanel, as well as third-party code. Replace this by a template that simply pulls the relevant context variables from the template and passes them on to `{% formattedfield %}` (which renders them using the old template, now renamed formatted_field.html). This will allow us to move logic from the template to the tag function without breaking the existing wagtailadmin/shared/field.html API.
This distinguishes the use case of wrapping form fields that are defined manually in HTML, versus working with Django form field objects which will shortly be given a `formattedfield` tag. We could have called these `rawfield` and `field`, but this avoids weirdness like `{% field field=field %}` (or just `{% field %}` which can easily be confused with `{{ field }}`) and better clarifies the purpose of the tag (and in particular why you shouldn't use it for hidden fields).
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).