From 0f328aff0a9169287446b6ede6b888454c54cef6 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 4 May 2024 20:07:59 +0100 Subject: [PATCH] Minify HTML --- requirements.txt | 1 + website/search/tests.py | 2 +- website/settings.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ef4b2f3..6490a3f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,6 +28,7 @@ django-permissions-policy==4.18.0 django-enforce-host==1.1.0 django-proxy==1.2.2 wagtail-lite-youtube-embed==0.1.0 +django-minify-html==1.7.1 # DRF OpenAPI dependencies uritemplate diff --git a/website/search/tests.py b/website/search/tests.py index ddedda7..15c474c 100644 --- a/website/search/tests.py +++ b/website/search/tests.py @@ -38,7 +38,7 @@ class SearchPageTestCase(TestCase): self.assertEqual(search_input.attrs["name"], "q") self.assertEqual(search_input.attrs["hx-get"], "results/") - self.assertEqual(search_input.attrs["value"], "") + self.assertEqual(search_input.attrs.get("value", ""), "") self.assertEqual(len(soup.select(search_input.attrs["hx-target"])), 1) self.assertEqual(len(soup.select(search_input.attrs["hx-indicator"])), 2) diff --git a/website/settings.py b/website/settings.py index 862c1e4..e424730 100644 --- a/website/settings.py +++ b/website/settings.py @@ -79,6 +79,7 @@ INSTALLED_APPS = [ "wagtail_2fa", "django_otp", "django_otp.plugins.otp_totp", + "django_minify_html", "health_check", "health_check.db", "health_check.cache", @@ -99,6 +100,7 @@ MIDDLEWARE = [ "corsheaders.middleware.CorsMiddleware", "enforce_host.EnforceHostMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware", + "django_minify_html.middleware.MinifyHtmlMiddleware", "django.middleware.common.CommonMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.csrf.CsrfViewMiddleware",