Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
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
钟尚武
sun
Commits
6997c166
Commit
6997c166
authored
Jul 24, 2019
by
yangchenglin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pictoria search
parent
4c0d5856
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
search.py
api/search.py
+17
-0
urls.py
api/urls.py
+1
-0
No files found.
api/search.py
View file @
6997c166
...
@@ -107,3 +107,19 @@ class PictorialSearchView(APIView):
...
@@ -107,3 +107,19 @@ class PictorialSearchView(APIView):
return
{
return
{
'data'
:
[
'{id}:{name}'
.
format
(
id
=
search_data
[
'id'
],
name
=
search_data
[
'name'
])
for
search_data
in
data
]
'data'
:
[
'{id}:{name}'
.
format
(
id
=
search_data
[
'id'
],
name
=
search_data
[
'name'
])
for
search_data
in
data
]
}
}
class
PictorialActivitySearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
offset
,
count
=
get_offset_count
(
request
)
try
:
data
=
self
.
rpc
[
'venus/sun/activity/pictorial/search'
](
name
=
name
,
offset
=
offset
,
count
=
count
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
[
'{id}:{name}'
.
format
(
id
=
search_data
[
'id'
],
name
=
search_data
[
'name'
])
for
search_data
in
data
]
}
\ No newline at end of file
api/urls.py
View file @
6997c166
...
@@ -229,6 +229,7 @@ search_urlpatterns = [
...
@@ -229,6 +229,7 @@ search_urlpatterns = [
url
(
r'search/topic$'
,
TopicSearchView
.
as_view
()),
url
(
r'search/topic$'
,
TopicSearchView
.
as_view
()),
url
(
r'search/tagtype$'
,
TagTypeSearchView
.
as_view
()),
url
(
r'search/tagtype$'
,
TagTypeSearchView
.
as_view
()),
url
(
r'search/pictorial$'
,
PictorialSearchView
.
as_view
()),
url
(
r'search/pictorial$'
,
PictorialSearchView
.
as_view
()),
url
(
r'search/pictorial_activity$'
,
PictorialActivitySearchView
.
as_view
()),
]
]
common_urlpatterns
=
[
common_urlpatterns
=
[
...
...
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