mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-12 22:25:44 -04:00
also search url, timestamp, tags on public index
This commit is contained in:
parent
f6c3683ab8
commit
8a4edb45e7
2 changed files with 3 additions and 2 deletions
|
@ -9,6 +9,7 @@ from django.http import HttpResponse
|
||||||
from django.views import View, static
|
from django.views import View, static
|
||||||
from django.views.generic.list import ListView
|
from django.views.generic.list import ListView
|
||||||
from django.views.generic import FormView
|
from django.views.generic import FormView
|
||||||
|
from django.db.models import Q
|
||||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||||
|
|
||||||
from core.models import Snapshot
|
from core.models import Snapshot
|
||||||
|
@ -107,7 +108,7 @@ class PublicArchiveView(ListView):
|
||||||
qs = super().get_queryset(**kwargs)
|
qs = super().get_queryset(**kwargs)
|
||||||
query = self.request.GET.get('q')
|
query = self.request.GET.get('q')
|
||||||
if query:
|
if query:
|
||||||
qs = qs.filter(title__icontains=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:
|
for snapshot in qs:
|
||||||
snapshot.icons = snapshot_icons(snapshot)
|
snapshot.icons = snapshot_icons(snapshot)
|
||||||
return qs
|
return qs
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<form id="changelist-search" action="{% url 'public-index' %}" method="get">
|
<form id="changelist-search" action="{% url 'public-index' %}" method="get">
|
||||||
<div>
|
<div>
|
||||||
<label for="searchbar"><img src="/static/admin/img/search.svg" alt="Search"></label>
|
<label for="searchbar"><img src="/static/admin/img/search.svg" alt="Search"></label>
|
||||||
<input type="text" size="40" name="q" value="" id="searchbar" autofocus placeholder="Title, URL, or content...".>
|
<input type="text" size="40" name="q" value="" id="searchbar" autofocus placeholder="Title, URL, tags, timestamp, or content...".>
|
||||||
<input type="submit" value="Search" style="height: 36px; padding-top: 6px; margin: 8px"/>
|
<input type="submit" value="Search" style="height: 36px; padding-top: 6px; margin: 8px"/>
|
||||||
<input type="button"
|
<input type="button"
|
||||||
value="♺"
|
value="♺"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue