Adds two new helper static methods:
- `Page.route_for_request()` - to find the page route, given a request
object and a URL path
- `Page.find_for_request()` - to find the page given, a request object and a URL
path
Ref: https://github.com/wagtail/wagtail/pull/11815/files#r1556095493
test_group_edit was failing when run after 3pm UTC, due to the output being rendered as "Just now" instead of an explicit time. This was due to a previously unsurfaced logic error in the timesince_last_update tag: if the timestamp was passed as a timezone-aware datetime in UTC, it was failing to translate this to local time and thus it compared as a different date, even if it was only from a moment ago. Consequently, it was following the "X days ago" path that was only supposed to be used for timestamps before today.
With this fixed, the special-case for "Just now" can be removed since it won't come into play for timestamps of yesterday and earlier. (Well, technically it could in the first minute after midnight, but that really doesn't warrant a special case...)
and remove any other _editor_js.html includes from templates that extend
wagtailadmin/generic/form.html, either directly or via
wagtailadmin/generic/{create,edit}.html templates.
Fixes#11760Fixes#11799
We only support Django 4.2 and 5.0. DRF v3.14.0 was released on
22-09-2022, while Django 4.2 was released on 03-04-2023. This means
Django 4.2 and 5.0 support were officially introduced in DRF 3.15.0.
While our tests used to indicate our use of an older version of DRF
didn't cause any issues when installed with a newer version of Django,
we should bump this anyway. This prevents people from installing a
cached version of DRF that we "claim" to be compatible with Wagtail,
but in reality DRF itself doesn't officially support our minimum Django
version. In such cases, the installation can still proceed as DRF does
not impose an upper bound on Django.
This also fixes an issue where our tests would fail when installed with
DRF < 3.15.0 as the PermissionDenied error messages became more
specific.
Django's test runner appends 'testserver' to your ALLOWED_HOSTS
setting. If your project has `ALLOWED_HOSTS=['*']` (which is totally
legit for Google App Engine standard) this means the setting value is
`ALLOWED_HOSTS=['*', 'testserver']` and Wagtail's dummy request helper
was setting the request SERVER_NAME to '*'.
But '*' is not a valid host name, causing a DisallowedHost exception.
This change sets the SERVER_NAME to 'example.com' in that case.
- We have other references to this command added in 5.2 however we did not include this in the page that goes into detail of Image renditions
- See #8166