Commit 7f579241 authored by 段英荣's avatar 段英荣

modify view

parent 85d7b568
...@@ -26,6 +26,7 @@ def auto_complete(request): ...@@ -26,6 +26,7 @@ def auto_complete(request):
""" """
q = request.GET.get('q', '').strip() q = request.GET.get('q', '').strip()
if not q: if not q:
return json_http_response({'error': 0, 'data': []}) return json_http_response({'error': 0, 'data': []})
...@@ -35,6 +36,8 @@ def auto_complete(request): ...@@ -35,6 +36,8 @@ def auto_complete(request):
'error': 0, 'error': 0,
'data': data, 'data': data,
} }
logging.info("duan add,q is:%s,result:%s" % (str(q).encode("utf-8"),str(result).encode('utf-8')))
return json_http_response(result) return json_http_response(result)
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
...@@ -17,6 +17,9 @@ from django.conf.urls import url ...@@ -17,6 +17,9 @@ from django.conf.urls import url
from django.contrib import admin from django.contrib import admin
from search.views import auto_complete from search.views import auto_complete
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^search/auto_complete/$', auto_complete), url(r'^search/auto_complete/$', auto_complete),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment