forked from mirrors/bookwyrm
Python formatting for black update
This commit is contained in:
parent
29a7c59d5f
commit
f86016ba33
3 changed files with 15 additions and 18 deletions
|
@ -36,22 +36,19 @@ def get_next_shelf(current_shelf):
|
|||
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(
|
||||
f"active_shelf-{user.id}-{book.id}",
|
||||
lambda u, b: (
|
||||
models.ShelfBook.objects.filter(
|
||||
shelf__user=u,
|
||||
book__parent_work__editions=b,
|
||||
).first()
|
||||
or False
|
||||
),
|
||||
user,
|
||||
book,
|
||||
timeout=15552000,
|
||||
)
|
||||
or {"book": book}
|
||||
)
|
||||
return cache.get_or_set(
|
||||
f"active_shelf-{user.id}-{book.id}",
|
||||
lambda u, b: (
|
||||
models.ShelfBook.objects.filter(
|
||||
shelf__user=u,
|
||||
book__parent_work__editions=b,
|
||||
).first()
|
||||
or False
|
||||
),
|
||||
user,
|
||||
book,
|
||||
timeout=15552000,
|
||||
) or {"book": book}
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=False)
|
||||
|
|
|
@ -430,7 +430,7 @@ class ModelFields(TestCase):
|
|||
output = instance.field_to_activity(user.avatar)
|
||||
self.assertIsNotNone(
|
||||
re.match(
|
||||
fr"https:\/\/{DOMAIN}\/.*\.jpg",
|
||||
rf"https:\/\/{DOMAIN}\/.*\.jpg",
|
||||
output.url,
|
||||
)
|
||||
)
|
||||
|
|
|
@ -20,7 +20,7 @@ django-storages==1.11.1
|
|||
django-redis==5.2.0
|
||||
|
||||
# Dev
|
||||
black==21.4b0
|
||||
black==21.4b2
|
||||
pytest-django==4.1.0
|
||||
pytest==6.1.2
|
||||
pytest-cov==2.10.1
|
||||
|
|
Loading…
Reference in a new issue