Merge pull request #586 from mouse-reeve/list-tweaks

List tweaks
This commit is contained in:
Mouse Reeve 2021-02-03 16:45:05 -08:00 committed by GitHub
commit c529ecfb9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

View File

@ -9,8 +9,8 @@
</h4> </h4>
</header> </header>
<div class="card-image is-flex"> <div class="card-image is-flex">
{% for book in list.books.all|slice:5 %} {% for book in list.listitem_set.all|slice:5 %}
{% include 'snippets/book_cover.html' with book=book size="small" %} {% include 'snippets/book_cover.html' with book=book.book size="small" %}
{% endfor %} {% endfor %}
</div> </div>
<div class="card-content is-flex-grow-0"> <div class="card-content is-flex-grow-0">

View File

@ -33,9 +33,7 @@
{% if lists %} {% if lists %}
<section class="block content"> <section class="block content">
<h2 class="title">Recent Lists</h2> <h2 class="title">Recent Lists</h2>
{% if request.user.list_set.exists %}
{% include 'lists/list_items.html' with lists=lists %} {% include 'lists/list_items.html' with lists=lists %}
{% endif %}
</section> </section>
<div> <div>
{% include 'snippets/pagination.html' with page=lists path=path %} {% include 'snippets/pagination.html' with page=lists path=path %}

View File

@ -29,6 +29,7 @@ class Lists(View):
user = request.user if request.user.is_authenticated else None user = request.user if request.user.is_authenticated else None
lists = models.List.objects.filter( lists = models.List.objects.filter(
~Q(user=user), ~Q(user=user),
books__isnull=False,
).all() ).all()
lists = privacy_filter(request.user, lists, ['public', 'followers']) lists = privacy_filter(request.user, lists, ['public', 'followers'])