X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/6b6ff36189e97efb3b463643018806e9ff8e14a8..11135898543370ecf4ffa95dbea14cba4c33f57c:/src/cover/views.py?ds=sidebyside diff --git a/src/cover/views.py b/src/cover/views.py index 5ea4a6c2..302f5f52 100644 --- a/src/cover/views.py +++ b/src/cover/views.py @@ -150,9 +150,14 @@ def image_file(request, pk): @active_tab('cover') def image_list(request): + qs = Image.objects.all().order_by('-id') + only_unused = request.GET.get('unused') + if only_unused: + qs = qs.filter(book=None) return render(request, "cover/image_list.html", { - 'object_list': Image.objects.all().order_by('-id'), + 'object_list': qs, 'can_add': request.user.has_perm('cover.add_image'), + 'only_unused': only_unused, })