blob: 7e36296658e3e69b5b21a135f41a80c325bf1308 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# -*- coding: utf-8 -*-
from django.shortcuts import render_to_response
from django.http import HttpResponse,HttpResponseRedirect,HttpResponseNotFound
from django.template import RequestContext
from haystack.query import SearchQuerySet
from haystack.inputs import AutoQuery
from .models import Query
from .forms import QuerySearchForm
def query(request):
u'''
问题查询
'''
if request.method == "GET":
return render_to_response('search/query/index.html',
context_instance=RequestContext(request))
else:
form = QuerySearchForm(request.POST)
results = form.search()
q = request.POST.get('q', '')
return render_to_response('search/query/index.html',
locals()
, context_instance=RequestContext(request))
|