fix snapshot icon caching and ordering

This commit is contained in:
Nick Sweeting
2021-04-01 02:22:15 -04:00
parent fc5d99b4b4
commit 59d5423483
3 changed files with 6 additions and 6 deletions

View File

@@ -209,7 +209,7 @@ class PublicIndexView(ListView):
template_name = 'public_index.html'
model = Snapshot
paginate_by = SNAPSHOTS_PER_PAGE
ordering = ['title']
ordering = ['-added']
def get_context_data(self, **kwargs):
return {
@@ -223,10 +223,6 @@ class PublicIndexView(ListView):
query = self.request.GET.get('q')
if query:
qs = qs.filter(Q(title__icontains=query) | Q(url__icontains=query) | Q(timestamp__icontains=query) | Q(tags__name__icontains=query))
for snapshot in qs:
# lazy load snapshot icons, otherwise it will load icons for entire index at once
snapshot.icons = lambda: snapshot_icons(snapshot)
return qs
def get(self, *args, **kwargs):