From e5ff4ac36d314b0f9047ea7cdbc790383bb197ff Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 22 May 2021 18:02:14 -0700 Subject: [PATCH] Python formatting --- bookwyrm/templatetags/bookwyrm_tags.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index 072ff6634..3f33643bf 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -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}