1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-10 06:47:58 +00:00
py-i2phosts/pyi2phosts/search/views.py

19 lines
500 B
Python
Raw Normal View History

2010-11-12 19:53:31 +00:00
from django.db.models import Q
from pyi2phosts.postkey.models import i2phost
from pyi2phosts.lib.generic import HostsListsView
2010-11-12 19:53:31 +00:00
class SearchedHostsListsView(HostsListsView):
""" Renders list of hosts matching search request """
def get_queryset(self):
q = self.request.GET.get('q', '')
fil = Q(name__icontains=q) | Q(b64hash__contains=q)
queryset = i2phost.objects.filter(fil)
return queryset
template_name = 'search_results.html'
template_object_name = 'host_list'
paginate_by = 40