mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 00:50:35 +00:00
Safely return if there are no current shelves
This commit is contained in:
parent
8e8f46ee51
commit
ba4df5b38b
1 changed files with 1 additions and 1 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue