mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 00:50:35 +00:00
CHeck for current shelves attr before querying for it
This commit is contained in:
parent
995e2c47db
commit
35131262ff
1 changed files with 3 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue