Fix failure to 404

This commit is contained in:
Vivianne Langdon 2022-03-02 04:07:13 -08:00
parent 81594892ef
commit 8838875879

View file

@ -47,12 +47,12 @@ class Book(View):
.first()
)
if r := maybe_redirect_local_path(request, book):
return r
if not book or not book.parent_work:
raise Http404()
if r := maybe_redirect_local_path(request, book):
return r
# all reviews for all editions of the book
reviews = models.Review.privacy_filter(request.user).filter(
book__parent_work__editions=book