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
f8a99531
Commit
f8a99531
authored
Nov 15, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加过滤筛选
parent
7032fb40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
pick.py
api/pick.py
+2
-2
base.py
utils/base.py
+22
-1
No files found.
api/pick.py
View file @
f8a99531
...
...
@@ -10,11 +10,11 @@ class PickListView(APIView):
def
get
(
self
,
request
):
page
=
request
.
GET
.
get
(
'page'
,
1
)
limit
=
request
.
GET
.
get
(
'limit'
,
10
)
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
try
:
data
=
self
.
rpc
[
'venus/community/pick/get'
](
offset
=
page
,
limit
=
limit
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/community/pick/get'
](
offset
=
page
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
raise
e
print
(
data
)
return
data
def
post
(
self
,
request
):
...
...
utils/base.py
View file @
f8a99531
...
...
@@ -6,7 +6,7 @@
# Date : 16/03/25 13:15:41
# Desc : view 等 基类
#
import
json
from
functools
import
wraps
from
distutils.version
import
LooseVersion
from
django.views.decorators.csrf
import
csrf_exempt
...
...
@@ -292,6 +292,27 @@ class APIView(View):
start_num
=
(
page
-
1
)
*
page_size
return
start_num
def
make_pair
(
self
,
data
):
val
=
data
.
pop
(
'value'
,
''
)
key
=
data
.
pop
(
'key'
,
''
)
if
key
and
key
not
in
[
'id'
]:
key
+=
'__contains'
if
key
:
data
.
update
({
key
:
val
})
for
key
in
list
(
data
.
keys
()):
if
data
.
get
(
key
)
==
''
:
del
data
[
key
]
return
data
def
handle_filter
(
self
,
filter
):
if
not
isinstance
(
filter
,
str
):
return
{}
filter_data
=
json
.
loads
(
filter
)
return
self
.
make_pair
(
filter_data
)
class
ClientDefaultArgs
(
LazyAttrDict
):
"""
...
...
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