From 846489e88e22f837ae48a2a4e19608626e9629b2 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 31 Jan 2021 11:21:50 -0800 Subject: [PATCH] Only show approved list items --- bookwyrm/templates/lists/list.html | 4 ++-- bookwyrm/views/list.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bookwyrm/templates/lists/list.html b/bookwyrm/templates/lists/list.html index 200f5770f..b9b9ce86f 100644 --- a/bookwyrm/templates/lists/list.html +++ b/bookwyrm/templates/lists/list.html @@ -23,11 +23,11 @@
- {% if not list.books.exists %} + {% if not items.exists %}

This list is currently empty

{% else %}
    - {% for item in list.listitem_set.all %} + {% for item in items %}
  1. diff --git a/bookwyrm/views/list.py b/bookwyrm/views/list.py index ff2a2f21e..8d3e50eec 100644 --- a/bookwyrm/views/list.py +++ b/bookwyrm/views/list.py @@ -64,16 +64,18 @@ class List(View): ) suggestions = [s.book for s in suggestions[:5]] if len(suggestions) < 5: - suggestions += [s.default_edition for s in \ - models.Work.objects.filter( - ~Q(editions__in=book_list.books.all()), - ).order_by('-updated_date') + suggestions += [ + s.default_edition for s in \ + models.Work.objects.filter( + ~Q(editions__in=book_list.books.all()), + ).order_by('-updated_date') ][:5 - len(suggestions)] data = { 'title': '%s | Lists' % book_list.name, 'list': book_list, + 'items': book_list.listitem_set.filter(approved=True), 'suggested_books': suggestions, 'list_form': forms.ListForm(instance=book_list), 'query': query or ''