mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-14 15:14:31 -04:00
feat: Use prefetch related to reduce the number of queries to the database on public index view
This commit is contained in:
parent
8cfad64271
commit
c565fad75c
2 changed files with 27 additions and 57 deletions
|
@ -98,6 +98,7 @@ class PublicArchiveView(ListView):
|
|||
query = self.request.GET.get('q')
|
||||
if query:
|
||||
qs = Snapshot.objects.filter(title__icontains=query)
|
||||
qs = qs.prefetch_related("archiveresult_set").all()
|
||||
for snapshot in qs:
|
||||
snapshot.icons = get_icons(snapshot)
|
||||
return qs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue