diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 34c356f..e0d107d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ static: expire_in: 2 hours pip: - image: python:3.11-slim + image: python:3.12-slim stage: build variables: PIP_CACHE_DIR: $CI_PROJECT_DIR/.pip-cache @@ -45,7 +45,7 @@ pip: expire_in: 2 hours .python_test_template: - image: python:3.11-slim + image: python:3.12-slim stage: test dependencies: - pip diff --git a/Dockerfile b/Dockerfile index cb9ff9c..ff5b868 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY ./static/src ./static/src RUN npm run build # The actual container -FROM python:3.11-slim as production +FROM python:3.12-slim as production ENV VIRTUAL_ENV=/venv diff --git a/dev-requirements.txt b/dev-requirements.txt index cabaabc..2830876 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,13 +1,13 @@ -r requirements.txt honcho==1.1.0 -black==23.7.0 -django-browser-reload==1.11.0 +black==23.12.1 +django-browser-reload==1.12.1 django-debug-toolbar -types-requests==2.31.0.1 -mypy==1.5.1 -wagtail-factories==4.0.0 -coverage==7.3.0 -djlint==1.31.0 -types-pyyaml==6.0.12.9 -ruff==0.0.278 +types-requests +mypy==1.8.0 +wagtail-factories==4.1.0 +coverage==7.4.0 +djlint==1.34.1 +types-pyyaml +ruff==0.1.11 diff --git a/requirements.txt b/requirements.txt index 2bc5147..e74b1a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,30 +1,30 @@ -Django==3.2.22 -wagtail==4.1.8 +Django==5.0.1 +wagtail==5.2.2 django-environ==0.11.2 -whitenoise[brotli]==6.5.0 -Pygments==2.16.1 -beautifulsoup4==4.11.2 -lxml==4.9.1 -requests==2.31.0 -wagtail-generic-chooser==0.5.1 -django-rq==2.8.0 -django-redis==5.3.0 +whitenoise[brotli]==6.6.0 +Pygments==2.17.2 +beautifulsoup4 +lxml==5.0.0 +requests +wagtail-generic-chooser==0.6 +django-rq==2.10.1 +django-redis==5.4.0 gunicorn==21.2.0 -psycopg2==2.9.6 +psycopg2==2.9.9 djangorestframework -django-htmx==1.16.0 -wagtail-metadata==4.0.3 +django-htmx==1.17.2 +wagtail-metadata==5.0.0 django-plausible==0.5.0 -sentry-sdk==1.29.2 +sentry-sdk django-sri==0.7.0 -wagtail-2fa==1.6.5 +wagtail-2fa==1.6.9 django-health-check==3.17.0 -wagtail-autocomplete==0.10.0 -Wand==0.6.11 +wagtail-autocomplete==0.11.0 +Wand==0.6.13 django3-cache-decorator==0.5.2 -django-cors-headers==4.2.0 +django-cors-headers==4.3.1 django-csp==3.7 -django-permissions-policy==4.17.0 +django-permissions-policy==4.18.0 django-enforce-host==1.1.0 django-proxy==1.2.2 wagtail-lite-youtube-embed==0.1.0 @@ -34,7 +34,7 @@ uritemplate PyYAML # Use custom `wagtail-favicon` with performance improvements -git+https://github.com/RealOrangeOne/wagtail-favicon@4586efaac746085338fc7d61713006d9adc62d2e +git+https://github.com/RealOrangeOne/wagtail-favicon@b892165e047b35c46d7244109b9ad9226d32a213 -# Use custom `wagtail-draftail-snippet` with support for Wagtail 4.1 -git+https://github.com/RealOrangeOne/wagtail-draftail-snippet@0924ab12b1ca205b94ccd9a34ecc446d7ac422e5 +# Use custom `wagtail-draftail-snippet` with support for Wagtail 5.x +git+https://github.com/aaronhaslett/wagtail-draftail-snippet@347cf41b29e0aa1ef43b53632ef29f07967a19e1 diff --git a/static/src/scss/_search.scss b/static/src/scss/_search.scss index 851116e..7b143dd 100644 --- a/static/src/scss/_search.scss +++ b/static/src/scss/_search.scss @@ -14,10 +14,6 @@ body.page-searchpage { max-width: 80%; } - .htmx-request i { - animation: search-loading 1.5s linear infinite; - } - #search-results > p { font-size: 1.5rem; text-align: center; @@ -47,9 +43,19 @@ body.page-searchpage { #search-page-indicator { text-align: center; margin-top: 1.5rem; + font-size: $size-3; &:not(.htmx-request) { display: none; } } + + // The search icon is hidden during requests + #search-icon { + opacity: 1 !important; + + &.htmx-request { + opacity: 0 !important; + } + } } diff --git a/website/blog/templates/blog/blog_post_list_page.html b/website/blog/templates/blog/blog_post_list_page.html index 9ab42d6..6327720 100644 --- a/website/blog/templates/blog/blog_post_list_page.html +++ b/website/blog/templates/blog/blog_post_list_page.html @@ -11,11 +11,11 @@
{% for page in listing_pages %} {% ifchanged %} -

+

-

+ {% endifchanged %} {% include "common/listing-item.html" %} diff --git a/website/blog/templates/blog/blog_post_page.html b/website/blog/templates/blog/blog_post_page.html index 7c4928d..f6f2a2b 100644 --- a/website/blog/templates/blog/blog_post_page.html +++ b/website/blog/templates/blog/blog_post_page.html @@ -1,26 +1,26 @@ {% extends "common/content_page.html" %} -{% load cache util_tags %} +{% load wagtail_cache %} {% block post_content %} {{ block.super }} {% if not request.is_preview %} - {% cache FRAGMENT_CACHE_TTL|jitter:FRAGMENT_CACHE_TTL_JITTER "similar-content" page.id request.is_preview %} -
-

Similar content

+ {% wagtailpagecache FRAGMENT_CACHE_TTL "similar-content" %} +
+

Similar content

-

- View all → -

+

+ View all → +

- {% for page in page.get_similar_posts %} - {% block listing_item %} - {% include "common/listing-item.html" %} - {% endblock %} - {% endfor %} + {% for page in page.get_similar_posts %} + {% block listing_item %} + {% include "common/listing-item.html" %} + {% endblock %} + {% endfor %} -
- {% endcache %} - {% endif %} +
+ {% endwagtailpagecache %} +{% endif %} {% endblock %} diff --git a/website/blog/templates/blog/blog_post_tag_list_page.html b/website/blog/templates/blog/blog_post_tag_list_page.html index 70de575..2152c5c 100644 --- a/website/blog/templates/blog/blog_post_tag_list_page.html +++ b/website/blog/templates/blog/blog_post_tag_list_page.html @@ -7,9 +7,9 @@
-

+

{{ page.title }} -

+

{{ page.summary }}

diff --git a/website/blog/tests.py b/website/blog/tests.py index 1c9929a..f9006b3 100644 --- a/website/blog/tests.py +++ b/website/blog/tests.py @@ -18,7 +18,7 @@ class BlogPostPageTestCase(TestCase): self.assertEqual(response.status_code, 200) def test_queries(self) -> None: - with self.assertNumQueries(48): + with self.assertNumQueries(41): self.client.get(self.page.url) @@ -76,7 +76,7 @@ class BlogPostListPageTestCase(TestCase): self.assertEqual(len(response.context["listing_pages"]), 2) def test_queries(self) -> None: - with self.assertNumQueries(44): + with self.assertNumQueries(37): self.client.get(self.page.url) def test_feed_accessible(self) -> None: diff --git a/website/common/templates/base.html b/website/common/templates/base.html index 90c9fc2..e3522c5 100644 --- a/website/common/templates/base.html +++ b/website/common/templates/base.html @@ -1,4 +1,4 @@ -{% load static wagtailcore_tags wagtailuserbar navbar_tags footer_tags plausible_wagtail favicon_tags sri cache %} +{% load static wagtailcore_tags wagtailuserbar navbar_tags footer_tags plausible_wagtail favicon_tags sri wagtail_cache %} @@ -32,31 +32,31 @@ {% wagtailuserbar %} - {% cache 1800 "navbar" request.is_preview %} - {% navbar %} - {% endcache %} + {% wagtailcache 1800 "navbar" %} + {% navbar %} + {% endwagtailcache %} - {% block main %} -
- {% block main_content %}{% endblock %} -
- {% endblock %} + {% block main %} +
+ {% block main_content %}{% endblock %} +
+ {% endblock %} - {% cache 1800 "footer" request.is_preview %} - {% footer %} - {% endcache %} + {% wagtailcache 1800 "footer" %} + {% footer %} +{% endwagtailcache %} - {# Not async to avoid bright flashes #} - {% sri_static "js/dark-mode.js" %} +{# Not async to avoid bright flashes #} +{% sri_static "js/dark-mode.js" %} - + - {% block extra_js %}{% endblock %} +{% block extra_js %}{% endblock %} - {% block plausible %} - {% if not request.user.is_authenticated or not request.is_preview %} - {% plausible %} - {% endif %} - {% endblock %} - +{% block plausible %} + {% if not request.user.is_authenticated or not request.is_preview %} + {% plausible %} + {% endif %} +{% endblock %} + diff --git a/website/common/templates/common/content-details.html b/website/common/templates/common/content-details.html index 109c179..e99f06b 100644 --- a/website/common/templates/common/content-details.html +++ b/website/common/templates/common/content-details.html @@ -1,36 +1,36 @@ -{% load wagtailcore_tags cache util_tags %} +{% load wagtailcore_tags wagtail_cache %} -{% cache FRAGMENT_CACHE_TTL|jitter:FRAGMENT_CACHE_TTL_JITTER "content-details" page.id request.is_preview %} -
- {% if page.date %} - - - - - {{ page.date|date:"Y-m-d" }} +{% wagtailpagecache FRAGMENT_CACHE_TTL "content-details" %} +
+ {% if page.date %} + + + - {% endif %} + {{ page.date|date:"Y-m-d" }} + + {% endif %} - {% if page.show_reading_time %} -
- - - - {{ page.reading_time_display }} -
- {% endif %} + {% if page.show_reading_time %} +
+ + + + {{ page.reading_time_display }} +
+ {% endif %} - {% if page.tags.all %} -
- - - - - - {% for tag in page.tags.all|dictsort:"slug" %} - #{{ tag.slug }} - {% endfor %} -
- {% endif %} -
-{% endcache %} + {% if page.tags.all %} +
+ + + + + + {% for tag in page.tags.all|dictsort:"slug" %} + #{{ tag.slug }} + {% endfor %} +
+ {% endif %} +
+{% endwagtailpagecache %} diff --git a/website/common/templates/common/listing-item.html b/website/common/templates/common/listing-item.html index 5d8eeb8..0321cb9 100644 --- a/website/common/templates/common/listing-item.html +++ b/website/common/templates/common/listing-item.html @@ -1,27 +1,27 @@ -{% load wagtailcore_tags cache util_tags %} +{% load wagtailcore_tags wagtail_cache util_tags %} -{% cache FRAGMENT_CACHE_TTL|jitter:FRAGMENT_CACHE_TTL_JITTER "listing-item" page.id request.is_preview breadcrumbs %} -
-
-
- {% if page.list_image_url %} - - - +{% wagtailpagecache FRAGMENT_CACHE_TTL "listing-item" breadcrumbs %} +
+
+
+ {% if page.list_image_url %} + + + + {% endif %} +
+
+
+ {% if breadcrumbs %} + {% include "common/breadcrumbs.html" with parents=page.get_parent_pages %} {% endif %} -
-
-
- {% if breadcrumbs %} - {% include "common/breadcrumbs.html" with parents=page.get_parent_pages %} - {% endif %} -

- {{ page.title }} -

- {% include "common/content-details.html" %} -

{{ page.summary }}

-
+

+ {{ page.title }} +

+ {% include "common/content-details.html" %} +

{{ page.summary }}

-
-{% endcache %} +
+ +{% endwagtailpagecache %} diff --git a/website/common/templates/common/pagination.html b/website/common/templates/common/pagination.html index 38c443f..89dffa8 100644 --- a/website/common/templates/common/pagination.html +++ b/website/common/templates/common/pagination.html @@ -1,14 +1,14 @@ {% load wagtailadmin_tags %} -