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
703b9f28
authored
2020-06-23 15:52:50 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix date filter
1 parent
a02a957e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
src/apps/doc/views.py
src/apps/doc/views.py
View file @
703b9f2
import
os
import
time
import
random
import
datetime
from
django.utils
import
timezone
from
django.db.utils
import
IntegrityError
from
django.db.models
import
Q
...
...
@@ -143,12 +144,15 @@ class DocView(GenericView, DocHandler):
application_id_query
=
Q
(
application_id
=
application_id
)
if
application_id
else
Q
()
data_source_query
=
Q
(
data_source
=
data_source
)
if
data_source
else
Q
()
business_type_query
=
Q
(
business_type
=
business_type
)
if
business_type
else
Q
()
upload_finish_time_query
=
Q
(
upload_finish_time__gte
=
upload_time_start
,
upload_finish_time__lte
=
upload_time_end
)
\
upload_finish_time_query
=
Q
(
upload_finish_time__gte
=
upload_time_start
,
upload_finish_time__lt
=
upload_time_end
+
datetime
.
timedelta
(
days
=
1
))
\
if
upload_time_start
and
upload_time_end
else
Q
()
create_time_query
=
Q
(
create_time__gte
=
create_time_start
,
create_time__lte
=
create_time_end
)
\
create_time_query
=
Q
(
create_time__gte
=
create_time_start
,
create_time__lt
=
create_time_end
+
datetime
.
timedelta
(
days
=
1
))
\
if
create_time_start
and
create_time_end
else
Q
()
query
=
status_query
&
application_id_query
&
data_source_query
&
business_type_query
\
&
upload_finish_time_query
&
create_time_query
print
(
query
)
val_tuple
=
(
'id'
,
'application_id'
,
'upload_finish_time'
,
'create_time'
,
'business_type'
,
'data_source'
,
'status'
)
doc_queryset
=
UploadDocRecords
.
objects
.
filter
(
query
)
.
values
(
*
val_tuple
)
.
order_by
(
'-upload_finish_time'
)
...
...
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