Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
search_tips
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
search_tips
Commits
7f579241
Commit
7f579241
authored
Jan 21, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify view
parent
85d7b568
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
views.py
search/views.py
+3
-0
urls.py
search_tips/urls.py
+3
-0
No files found.
search/views.py
View file @
7f579241
...
@@ -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
())
...
...
search_tips/urls.py
View file @
7f579241
...
@@ -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
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment