Show lists on book page

This commit is contained in:
Mouse Reeve 2021-02-15 11:30:22 -08:00
parent 7b749d6476
commit 8cb345886b
2 changed files with 16 additions and 0 deletions

View file

@ -224,6 +224,17 @@
</ul>
</section>
{% endif %}
{% if lists.exists %}
<section class="content block">
<h2 class="title is-5">Lists</h2>
<ul>
{% for list in lists %}
<li><a href="{{ list.local_path }}">{{ list.name }}</a></li>
{% endfor %}
</ul>
</section>
{% endif %}
</div>
</div>
</div>

View file

@ -15,6 +15,7 @@ from bookwyrm.activitypub import ActivitypubResponse
from bookwyrm.connectors import connector_manager
from bookwyrm.settings import PAGE_LENGTH
from .helpers import is_api_request, get_activity_feed, get_edition
from .helpers import privacy_filter
# pylint: disable= no-self-use
@ -94,6 +95,10 @@ class Book(View):
'ratings': reviews.filter(Q(content__isnull=True) | Q(content='')),
'rating': reviews.aggregate(Avg('rating'))['rating__avg'],
'tags': models.UserTag.objects.filter(book=book),
'lists': privacy_filter(
request.user,
book.list_set.all(),
['public', 'unlisted', 'followers']),
'user_tags': user_tags,
'user_shelves': user_shelves,
'other_edition_shelves': other_edition_shelves,