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.
21 lines
489 B
21 lines
489 B
from django.db.models import Q |
|
from django.views.generic import list_detail |
|
|
|
import settings |
|
from pyi2phosts.postkey.models import i2phost |
|
|
|
|
|
def search(request): |
|
q = request.GET.get('q', '') |
|
fil = Q(name__icontains=q) |
|
qs = i2phost.objects.filter(fil) |
|
return list_detail.object_list( |
|
request = request, |
|
queryset = qs, |
|
template_name = 'search_results.html', |
|
template_object_name = 'host', |
|
paginate_by = 40, |
|
extra_context = { |
|
'title': settings.SITE_NAME, |
|
} |
|
)
|
|
|