Python formatting
This commit is contained in:
parent
3d3ab6433e
commit
e5ff4ac36d
|
@ -69,9 +69,14 @@ def related_status(notification):
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
def active_shelf(context, book):
|
def active_shelf(context, book):
|
||||||
"""check what shelf a user has a book on, if any"""
|
"""check what shelf a user has a book on, if any"""
|
||||||
shelf = models.ShelfBook.objects.filter(
|
shelf = (
|
||||||
shelf__user=context["request"].user, book__in=book.parent_work.editions.all()
|
models.ShelfBook.objects.filter(
|
||||||
).select_related("book", "shelf").first()
|
shelf__user=context["request"].user,
|
||||||
|
book__in=book.parent_work.editions.all(),
|
||||||
|
)
|
||||||
|
.select_related("book", "shelf")
|
||||||
|
.first()
|
||||||
|
)
|
||||||
return shelf if shelf else {"book": book}
|
return shelf if shelf else {"book": book}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue