Only show approved list items

This commit is contained in:
Mouse Reeve 2021-01-31 11:21:50 -08:00
parent a2e69d783d
commit 846489e88e
2 changed files with 8 additions and 6 deletions

View file

@ -23,11 +23,11 @@
<div class="columns content">
<section class="column is-three-quarters">
{% if not list.books.exists %}
{% if not items.exists %}
<p>This list is currently empty</p>
{% else %}
<ol>
{% for item in list.listitem_set.all %}
{% for item in items %}
<li class="block">
<div class="card">
<header class="card-header">

View file

@ -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 ''