1
0
Fork 0
mirror of synced 2024-06-02 02:25:20 +12:00

Hotfix public page search

No ordering causes warning and fallback to default unfiltered QuerySet
This commit is contained in:
jdcaballerov 2020-12-01 10:46:11 -05:00
parent 4372cb6eec
commit 4d972571d0

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