Reuse online accounts query on contact page
This commit is contained in:
parent
94efdfb1cc
commit
adc6002217
1 changed files with 6 additions and 2 deletions
|
@ -44,14 +44,18 @@ class ContactPage(BaseContentPage):
|
||||||
def show_reading_time(self) -> bool:
|
def show_reading_time(self) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def online_accounts(self) -> models.QuerySet:
|
||||||
|
return OnlineAccount.objects.all().order_by("name")
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def table_of_contents(self) -> list[TocEntry]:
|
def table_of_contents(self) -> list[TocEntry]:
|
||||||
return [
|
return [
|
||||||
TocEntry(account.name, account.slug, 0, [])
|
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:
|
def get_context(self, request: HttpRequest) -> dict:
|
||||||
context = super().get_context(request)
|
context = super().get_context(request)
|
||||||
context["accounts"] = OnlineAccount.objects.all().order_by("name")
|
context["accounts"] = self.online_accounts
|
||||||
return context
|
return context
|
||||||
|
|
Loading…
Reference in a new issue