python formatting

This commit is contained in:
Mouse Reeve 2022-01-11 12:58:14 -08:00
parent 591bb955f8
commit 6baab5d5a9
1 changed files with 15 additions and 12 deletions

View File

@ -132,7 +132,8 @@ def related_status(notification):
def active_shelf(context, book):
"""check what shelf a user has a book on, if any"""
user = context["request"].user
return cache.get_or_set(
return (
cache.get_or_set(
f"active_shelf-{user.id}-{book.id}",
lambda u, b: (
models.ShelfBook.objects.filter(
@ -143,7 +144,9 @@ def active_shelf(context, book):
user,
book,
timeout=15552000,
) or {"book": book}
)
or {"book": book}
)
@register.simple_tag(takes_context=False)