Browse Source

Hotfix public page search

No ordering causes warning and fallback to default unfiltered QuerySet
jdcaballerov 5 years ago
parent
commit
69897f6121
1 changed files with 2 additions and 1 deletions
  1. 2 1
      archivebox/core/views.py

+ 2 - 1
archivebox/core/views.py

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