@ -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
|
||||
|
||||
|
||||
@ -28,6 +27,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)
|
||||
|
@ -1,7 +1,6 @@
|
||||
""" the good stuff! the books! """
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.cache import cache
|
||||
from django.core.cache.utils import make_template_fragment_key
|
||||
from django.db import transaction
|
||||
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
@ -46,12 +45,10 @@ class ReadingStatus(View):
|
||||
if not identifier:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
# invalidate the template cache
|
||||
cache_keys = [
|
||||
make_template_fragment_key("shelve_button", [request.user.id, book_id]),
|
||||
make_template_fragment_key("suggested_books", [request.user.id]),
|
||||
]
|
||||
cache.delete_many(cache_keys)
|
||||
# invalidate related caches
|
||||
cache.delete(
|
||||
f"active_shelf-{request.user.id}-{book_id}",
|
||||
)
|
||||
|
||||
desired_shelf = get_object_or_404(
|
||||
models.Shelf, identifier=identifier, user=request.user
|
||||
|
Reference in New Issue
Block a user