diff options
Diffstat (limited to '97suifangqa/apps/info/views.py')
-rw-r--r-- | 97suifangqa/apps/info/views.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/97suifangqa/apps/info/views.py b/97suifangqa/apps/info/views.py new file mode 100644 index 0000000..7e36296 --- /dev/null +++ b/97suifangqa/apps/info/views.py @@ -0,0 +1,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)) + + + + |