Merge pull request #559 from jdcaballerov/hotfix-public-search

Hotfix public page search
This commit is contained in:
Nick Sweeting 2020-12-01 10:56:32 -05:00 committed by GitHub
commit 193dde03f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,12 +92,13 @@ class PublicArchiveView(ListView):
template = 'snapshot_list.html'
model = Snapshot
paginate_by = 100
ordering = ['title']
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs)
query = self.request.GET.get('q')
if query:
qs = Snapshot.objects.filter(title__icontains=query)
qs = qs.filter(title__icontains=query)
for snapshot in qs:
snapshot.icons = get_icons(snapshot)
return qs