From 35131262ffa59d3036aa18e0f0df6bad178740e8 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 27 Sep 2021 11:17:53 -0700 Subject: [PATCH] CHeck for current shelves attr before querying for it --- bookwyrm/templatetags/bookwyrm_tags.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index 1c9151577..de3948868 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -70,6 +70,9 @@ 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""" + if hasattr(book, "current_shelves"): + return book.current_shelves[0] + shelf = ( models.ShelfBook.objects.filter( shelf__user=context["request"].user,