diff --git a/website/contact/models.py b/website/contact/models.py index 90e8c65..4591ee9 100644 --- a/website/contact/models.py +++ b/website/contact/models.py @@ -44,14 +44,18 @@ class ContactPage(BaseContentPage): def show_reading_time(self) -> bool: return False + @cached_property + def online_accounts(self) -> models.QuerySet: + return OnlineAccount.objects.all().order_by("name") + @cached_property def table_of_contents(self) -> list[TocEntry]: return [ TocEntry(account.name, account.slug, 0, []) - for account in OnlineAccount.objects.all().order_by("name") + for account in self.online_accounts ] def get_context(self, request: HttpRequest) -> dict: context = super().get_context(request) - context["accounts"] = OnlineAccount.objects.all().order_by("name") + context["accounts"] = self.online_accounts return context