diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index 072ff663..3f33643b 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -69,9 +69,14 @@ def related_status(notification): @register.simple_tag(takes_context=True) def active_shelf(context, book): """check what shelf a user has a book on, if any""" - shelf = models.ShelfBook.objects.filter( - shelf__user=context["request"].user, book__in=book.parent_work.editions.all() - ).select_related("book", "shelf").first() + shelf = ( + models.ShelfBook.objects.filter( + shelf__user=context["request"].user, + book__in=book.parent_work.editions.all(), + ) + .select_related("book", "shelf") + .first() + ) return shelf if shelf else {"book": book}