mirror of https://github.com/r4sas/py-i2phosts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
500 B
18 lines
500 B
from django.db.models import Q |
|
|
|
from pyi2phosts.postkey.models import i2phost |
|
from pyi2phosts.lib.generic import HostsListsView |
|
|
|
|
|
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
|
|
|