mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
Python formatting
This commit is contained in:
parent
3d3ab6433e
commit
e5ff4ac36d
1 changed files with 8 additions and 3 deletions
|
@ -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}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue