Caches query for landing page books
This commit is contained in:
@ -16,7 +16,6 @@ from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import emailing, forms, models
|
||||
from bookwyrm.settings import PAGE_LENGTH
|
||||
from bookwyrm.views import helpers
|
||||
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
@ -174,7 +173,6 @@ class InviteRequest(View):
|
||||
data = {
|
||||
"request_form": form,
|
||||
"request_received": received,
|
||||
"books": helpers.get_landing_books(),
|
||||
}
|
||||
return TemplateResponse(request, "landing/landing.html", data)
|
||||
|
||||
|
@ -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:
|
||||
|
@ -3,7 +3,6 @@ from django.template.response import TemplateResponse
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import forms
|
||||
from bookwyrm.views import helpers
|
||||
from bookwyrm.views.feed import Feed
|
||||
|
||||
|
||||
@ -36,6 +35,5 @@ class Landing(View):
|
||||
data = {
|
||||
"register_form": forms.RegisterForm(),
|
||||
"request_form": forms.InviteRequestForm(),
|
||||
"books": helpers.get_landing_books(),
|
||||
}
|
||||
return TemplateResponse(request, "landing/landing.html", data)
|
||||
|
Reference in New Issue
Block a user