Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
01efbccb
authored
2020-11-02 18:25:24 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix list page
1 parent
7c6bee8a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
src/apps/doc/views.py
src/apps/doc/views.py
View file @
01efbcc
...
...
@@ -252,18 +252,20 @@ class DocView(GenericView, DocHandler):
query
=
application_id_query
&
status_query
&
data_source_query
&
upload_finish_time_query
&
create_time_query
val_tuple
=
(
'id'
,
'application_id'
,
'upload_finish_time'
,
'create_time'
,
'data_source'
,
'status'
)
doc_class
,
prefix
=
self
.
get_doc_class
(
business_type
)
doc_queryset
=
doc_class
.
objects
.
filter
(
query
)
.
values
(
*
val_tuple
)
.
order_by
(
'-create_time'
)
doc_list
=
self
.
get_doc_list
(
doc_queryset
,
prefix
)
total
=
len
(
doc_list
)
total
=
doc_class
.
objects
.
filter
(
query
)
.
count
()
start_index
=
page_size
*
(
page
-
1
)
end_index
=
page_size
*
page
if
start_index
>=
total
>
0
:
raise
self
.
invalid_params
(
'页数不存在'
)
doc_queryset
=
doc_class
.
objects
.
filter
(
query
)
.
values
(
*
val_tuple
)
.
order_by
(
'-create_time'
)[
start_index
:
end_index
]
doc_list
=
self
.
get_doc_list
(
doc_queryset
,
prefix
)
# total = len(doc_list)
pagination
=
{
'current'
:
page
,
'total'
:
total
,
'page_size'
:
page_size
}
res
=
{
'pagination'
:
pagination
,
'doc_list'
:
doc_list
[
start_index
:
end_index
]
'doc_list'
:
doc_list
}
self
.
running_log
.
info
(
'[get doc list] [args={0}] [res={1}]'
.
format
(
args
,
res
))
return
response
.
ok
(
data
=
res
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment