Caches query for landing page books

This commit is contained in:
Mouse Reeve
2022-01-09 13:04:41 -08:00
parent e8c830750a
commit 0a182e8150
5 changed files with 21 additions and 22 deletions

View File

@ -153,24 +153,6 @@ def is_blocked(viewer, user):
return False
def get_landing_books():
"""list of books for the landing page"""
return list(
set(
models.Edition.objects.filter(
review__published_date__isnull=False,
review__deleted=False,
review__user__local=True,
review__privacy__in=["public", "unlisted"],
)
.exclude(cover__exact="")
.distinct()
.order_by("-review__published_date")[:6]
)
)
def load_date_in_user_tz_as_utc(date_str: str, user: models.User) -> datetime:
"""ensures that data is stored consistently in the UTC timezone"""
if not date_str: