From ba4df5b38be6988b2d16d9a67882038cb1df415d Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 27 Sep 2021 11:29:53 -0700 Subject: [PATCH] Safely return if there are no current shelves --- bookwyrm/templatetags/bookwyrm_tags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index de394886..07e518ce 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -71,7 +71,7 @@ def related_status(notification): def active_shelf(context, book): """check what shelf a user has a book on, if any""" if hasattr(book, "current_shelves"): - return book.current_shelves[0] + return book.current_shelves[0] if len(book.current_shelves) else {"book": book} shelf = ( models.ShelfBook.objects.filter(