1
0
Fork 0
mirror of synced 2024-06-26 18:10:24 +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 ed54df499e
commit 69897f6121

View file

@ -94,6 +94,7 @@ class PublicArchiveView(ListView):
template = 'snapshot_list.html'
model = Snapshot
paginate_by = 100
ordering = ['title']
def get_context_data(self, **kwargs):
return {
@ -106,7 +107,7 @@ class PublicArchiveView(ListView):
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 = snapshot_icons(snapshot)
return qs