Compare commits

..

1 Commits

Author SHA1 Message Date
Renovate 7d3569cc15 Update dependency black to v24 2024-04-26 08:02:19 +01:00
12 changed files with 9 additions and 42 deletions

View File

@ -1,7 +1,7 @@
-r requirements.txt
honcho==1.1.0
black==23.12.1
black==24.4.2
django-browser-reload==1.12.1
django-debug-toolbar
types-requests

View File

@ -14,9 +14,6 @@ server {
gzip_static on;
gzip on;
gzip_vary on;
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
@ -42,7 +39,6 @@ server {
location / {
proxy_pass http://localhost:8080;
gzip_types *;
}
location /static {

View File

@ -1,5 +1,5 @@
Django==5.0.4
wagtail==5.2.5
Django==5.0.1
wagtail==5.2.2
django-environ==0.11.2
whitenoise[brotli]==6.6.0
Pygments==2.17.2
@ -28,7 +28,6 @@ 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

View File

@ -1,5 +1,7 @@
{% extends "common/listing_page.html" %}
{% load wagtailroutablepage_tags %}
{% block hero_buttons %}
<a class="button is-radiusless" href="{{ page.tag_list_page_url }}" title="View tags"><i class="fas fa-tags" aria-hidden="true"></i></a>
{{ block.super }}

View File

@ -1,9 +0,0 @@
from django_minify_html.middleware import MinifyHtmlMiddleware
class CustomMinifyHtmlMiddleware(MinifyHtmlMiddleware):
minify_args = {
"do_not_minify_doctype": True,
"ensure_spec_compliant_unquoted_attribute_values": True,
"keep_spaces_between_attributes": True,
}

View File

@ -295,13 +295,6 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage):
def feed(self, request: HttpRequest) -> HttpResponse:
return redirect("feed", permanent=True)
@route(r"^random/$")
def random(self, request: HttpRequest) -> HttpResponse:
page = self.get_listing_pages().order_by("?").first()
if page is None:
return redirect(self.get_url(request=request), permanent=False)
return redirect(page.get_url(request=request), permanent=False)
class ListingPage(BaseListingPage):
pass

View File

@ -1,10 +1,8 @@
{% extends "common/content_page.html" %}
{% load wagtailadmin_tags wagtailroutablepage_tags %}
{% load wagtailadmin_tags %}
{% block hero_buttons %}
<a class="button is-radiusless" href="{% routablepageurl page 'random' %}" title="View random"><i class="fas fa-dice" aria-hidden="true"></i></a>
{% if listing_pages.has_previous %}
<a class="button is-radiusless" href="{% querystring page=listing_pages.previous_page_number %}" title="Previous page"><i class="fas fa-arrow-left" aria-hidden="true"></i></a>
{% endif %}

View File

@ -77,12 +77,3 @@ class ListingPageTestCase(TestCase):
self.assertEqual(
response.context["page"].get_meta_url(), self.page.full_url + "?page=2"
)
def test_random(self) -> None:
url = self.page.url + self.page.reverse_subpage("random")
with self.assertNumQueries(10):
response = self.client.get(url)
self.assertEqual(response.status_code, 302)
self.assertIn(
response.url, [page.get_url() for page in self.page.get_listing_pages()]
)

View File

@ -9,7 +9,6 @@ class GitHubLinguistHealthCheckBackend(BaseHealthCheckBackend):
colours = _get_linguist_colours()
except Exception as e:
self.add_error(str(e))
return
if colours is None:
self.add_error("No colours provided")

View File

@ -1,6 +1,5 @@
from django.core.cache import cache
from wagtail import hooks
from wagtail.models import Page
from website.common.utils import get_page_models
@ -8,7 +7,7 @@ from .utils import SingletonPageCache
@hooks.register("after_move_page")
def clear_singleton_url_cache(page_to_move: Page) -> None:
def clear_singleton_url_cache(**kwargs: dict) -> None:
"""
Clear all page caches, in case a parent has moved
"""

View File

@ -38,7 +38,7 @@ class SearchPageTestCase(TestCase):
self.assertEqual(search_input.attrs["name"], "q")
self.assertEqual(search_input.attrs["hx-get"], "results/")
self.assertNotIn("value", search_input.attrs) # Because of minify-html
self.assertEqual(search_input.attrs["value"], "")
self.assertEqual(len(soup.select(search_input.attrs["hx-target"])), 1)
self.assertEqual(len(soup.select(search_input.attrs["hx-indicator"])), 2)

View File

@ -79,7 +79,6 @@ INSTALLED_APPS = [
"wagtail_2fa",
"django_otp",
"django_otp.plugins.otp_totp",
"django_minify_html",
"health_check",
"health_check.db",
"health_check.cache",
@ -94,12 +93,12 @@ INSTALLED_APPS = [
]
MIDDLEWARE = [
"django.middleware.gzip.GZipMiddleware",
"django.middleware.security.SecurityMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"corsheaders.middleware.CorsMiddleware",
"enforce_host.EnforceHostMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"website.common.middleware.CustomMinifyHtmlMiddleware",
"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",