1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-09 14:28:03 +00:00
py-i2phosts/pyi2phosts/search/views.py

19 lines
540 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 LocalObjectList
2010-11-12 19:53:31 +00:00
class SearchedHostsListsView(LocalObjectList):
2015-10-26 18:55:35 +00:00
""" Renders list of hosts matching search request """
2015-10-26 18:55:35 +00:00
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
2015-10-26 18:55:35 +00:00
template_name = 'search_results.html'
context_object_name = 'host_list'
2015-10-26 18:55:35 +00:00
paginate_by = 40