Merge pull request #624 from mouse-reeve/book-lists
Show lists on book page
This commit is contained in:
commit
9cbecec8ac
|
@ -224,6 +224,17 @@
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
{% endif %}
|
{% 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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,7 @@ from bookwyrm.activitypub import ActivitypubResponse
|
||||||
from bookwyrm.connectors import connector_manager
|
from bookwyrm.connectors import connector_manager
|
||||||
from bookwyrm.settings import PAGE_LENGTH
|
from bookwyrm.settings import PAGE_LENGTH
|
||||||
from .helpers import is_api_request, get_activity_feed, get_edition
|
from .helpers import is_api_request, get_activity_feed, get_edition
|
||||||
|
from .helpers import privacy_filter
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable= no-self-use
|
# pylint: disable= no-self-use
|
||||||
|
@ -94,6 +95,10 @@ class Book(View):
|
||||||
'ratings': reviews.filter(Q(content__isnull=True) | Q(content='')),
|
'ratings': reviews.filter(Q(content__isnull=True) | Q(content='')),
|
||||||
'rating': reviews.aggregate(Avg('rating'))['rating__avg'],
|
'rating': reviews.aggregate(Avg('rating'))['rating__avg'],
|
||||||
'tags': models.UserTag.objects.filter(book=book),
|
'tags': models.UserTag.objects.filter(book=book),
|
||||||
|
'lists': privacy_filter(
|
||||||
|
request.user,
|
||||||
|
book.list_set.all(),
|
||||||
|
['public', 'unlisted', 'followers']),
|
||||||
'user_tags': user_tags,
|
'user_tags': user_tags,
|
||||||
'user_shelves': user_shelves,
|
'user_shelves': user_shelves,
|
||||||
'other_edition_shelves': other_edition_shelves,
|
'other_edition_shelves': other_edition_shelves,
|
||||||
|
|
Loading…
Reference in New Issue