diff options
author | Alvin Li <liweitianux@gmail.com> | 2013-08-13 14:13:24 +0800 |
---|---|---|
committer | Alvin Li <liweitianux@gmail.com> | 2013-08-13 14:13:24 +0800 |
commit | 9636d4a6767f49384d5c386bc3f1142c88b90613 (patch) | |
tree | 3a70f6d9e4be1791d36c87cc7cbfd1d5aa2b39dd /97suifangqa/apps/info/views.py | |
parent | 9383d9a8a5988d071766c3d08a5c946e9c5b02ae (diff) | |
download | 97dev-9636d4a6767f49384d5c386bc3f1142c88b90613.tar.bz2 |
cloned from 'bitbucket', 2013/08/13
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)) + + + + |