diff --git a/website/blog/tests.py b/website/blog/tests.py index 51ffce2..e49fac5 100644 --- a/website/blog/tests.py +++ b/website/blog/tests.py @@ -17,7 +17,7 @@ class BlogPostPageTestCase(TestCase): self.assertEqual(response.status_code, 200) def test_queries(self) -> None: - with self.assertNumQueries(47): + with self.assertNumQueries(48): self.client.get(self.page.url) @@ -76,7 +76,7 @@ class BlogPostListPageTestCase(TestCase): self.assertContains(response, self.page.reverse_subpage("feed")) def test_queries(self) -> None: - with self.assertNumQueries(44): + with self.assertNumQueries(45): 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 1a2476b..ab944b7 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 cache contact_tags %} @@ -16,6 +16,8 @@ + {% mastodon_link %} + {% sri_static "css/base.css" %} diff --git a/website/common/tests/test_pages.py b/website/common/tests/test_pages.py index a18e9f7..dafa683 100644 --- a/website/common/tests/test_pages.py +++ b/website/common/tests/test_pages.py @@ -35,7 +35,7 @@ class ContentPageTestCase(TestCase): self.assertEqual(response.status_code, 200) def test_queries(self) -> None: - with self.assertNumQueries(38): + with self.assertNumQueries(39): self.client.get(self.page.url) @@ -52,7 +52,7 @@ class ListingPageTestCase(TestCase): ContentPageFactory(parent=cls.page) def test_accessible(self) -> None: - with self.assertNumQueries(42): + with self.assertNumQueries(43): response = self.client.get(self.page.url) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.context["listing_pages"]), 2) diff --git a/website/common/tests/test_views.py b/website/common/tests/test_views.py index ac3deaf..c4aa1aa 100644 --- a/website/common/tests/test_views.py +++ b/website/common/tests/test_views.py @@ -22,7 +22,7 @@ class Error404PageTestCase(TestCase): ) def test_queries(self) -> None: - with self.assertNumQueries(22): + with self.assertNumQueries(23): self.client.get(self.url) diff --git a/website/contact/templatetags/contact_tags.py b/website/contact/templatetags/contact_tags.py new file mode 100644 index 0000000..77a53f1 --- /dev/null +++ b/website/contact/templatetags/contact_tags.py @@ -0,0 +1,16 @@ +from django.template import Library +from django.utils.html import format_html + +from website.contact.models import OnlineAccount + +register = Library() + + +@register.simple_tag() +def mastodon_link() -> str: + mastodon_account = OnlineAccount.objects.filter(name__iexact="mastodon").first() + + if mastodon_account is None: + return "" + + return format_html('', mastodon_account.url) diff --git a/website/search/tests.py b/website/search/tests.py index 01f51fa..860c6ca 100644 --- a/website/search/tests.py +++ b/website/search/tests.py @@ -89,7 +89,7 @@ class SearchPageResultsTestCase(TestCase): ) def test_too_high_page(self) -> None: - with self.assertNumQueries(47): + with self.assertNumQueries(48): response = self.client.get( self.url, {"q": "post", "page": 3}, HTTP_HX_REQUEST="true" )