mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-12 02:05:31 +00:00
Fixes black versioning error
This commit is contained in:
parent
7fdf07c6ec
commit
5df8bf03e6
1 changed files with 13 additions and 16 deletions
|
@ -36,22 +36,19 @@ def get_next_shelf(current_shelf):
|
||||||
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"""
|
||||||
user = context["request"].user
|
user = context["request"].user
|
||||||
return (
|
return cache.get_or_set(
|
||||||
cache.get_or_set(
|
f"active_shelf-{user.id}-{book.id}",
|
||||||
f"active_shelf-{user.id}-{book.id}",
|
lambda u, b: (
|
||||||
lambda u, b: (
|
models.ShelfBook.objects.filter(
|
||||||
models.ShelfBook.objects.filter(
|
shelf__user=u,
|
||||||
shelf__user=u,
|
book__parent_work__editions=b,
|
||||||
book__parent_work__editions=b,
|
).first()
|
||||||
).first()
|
or False
|
||||||
or False
|
),
|
||||||
),
|
user,
|
||||||
user,
|
book,
|
||||||
book,
|
timeout=15552000,
|
||||||
timeout=15552000,
|
) or {"book": book}
|
||||||
)
|
|
||||||
or {"book": book}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=False)
|
@register.simple_tag(takes_context=False)
|
||||||
|
|
Loading…
Reference in a new issue