Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hunter-ht.cn
Overview
Overview
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
刘莹莹
hunter-ht.cn
Commits
f7efaad1
Commit
f7efaad1
authored
Jun 05, 2020
by
liuyingying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改最新动态读取方式
parent
ff3668d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
view_page.py
hunter/views/view_page.py
+8
-10
No files found.
hunter/views/view_page.py
View file @
f7efaad1
...
...
@@ -83,14 +83,18 @@ def index_html(request):
article_year_list
[
year
]
=
[
art
]
newest_post_list
=
{}
# 读取最近7天内动态
# 读取最近7天内动态
,若读取最新论文4篇;文章2篇;CVE2条
start
=
datetime
.
datetime
.
now
()
.
date
()
-
datetime
.
timedelta
(
hours
=
23
*
7
,
minutes
=
59
,
seconds
=
59
)
newest_publication
=
Publications
.
objects
.
filter
(
date__gte
=
start
,
isOpen
=
'1'
)
.
order_by
(
'-editDateTime'
)
if
newest_publication
.
count
()
<
1
:
newest_publication
=
Publications
.
objects
.
filter
(
isOpen
=
'1'
)
.
order_by
(
'-editDateTime'
)[:
4
]
for
pub
in
newest_publication
:
pub
.
author
=
pub
.
uploadByUser
pub
.
url
=
'/static/publications/'
+
pub
.
link
.
split
(
'/'
)[
-
1
]
pub
.
date
=
str
(
pub
.
date
)[
5
:
10
]
newest_article
=
Articles
.
objects
.
filter
(
editDateTime__gte
=
start
)
.
order_by
(
'-editDateTime'
)
newest_article
=
Articles
.
objects
.
filter
(
editDateTime__gte
=
start
,
publish
=
2
)
.
order_by
(
'-editDateTime'
)
if
newest_article
.
count
()
<
1
:
newest_article
=
Articles
.
objects
.
all
()
.
order_by
(
'-editDateTime'
)[:
2
]
for
art
in
newest_article
:
users
=
User
.
objects
.
filter
(
userID
=
art
.
authorID
)
.
values
(
'name'
)
art
.
author
=
users
[
0
][
'name'
]
...
...
@@ -98,19 +102,13 @@ def index_html(request):
art
.
date
=
str
(
art
.
editDateTime
)[
5
:
10
]
newest_cve
=
Bugs
.
objects
.
filter
(
datetime__gte
=
start
)
.
order_by
(
'-datetime'
)
if
newest_cve
.
count
()
<
1
:
newest_cve
=
Bugs
.
objects
.
all
()
.
order_by
(
'-datetime'
)[:
2
]
for
cve
in
newest_cve
:
cve
.
title
=
cve
.
identifier
cve
.
author
=
cve
.
owner
cve
.
date
=
str
(
cve
.
datetime
)[
5
:
10
]
# 读取最新论文4篇;文章2篇;CVE2条
if
newest_publication
.
count
()
<
1
:
newest_publication
=
Publications
.
objects
.
all
()
.
order_by
(
'-editDateTime'
)[:
4
]
if
newest_article
.
count
()
<
1
:
newest_article
=
Articles
.
objects
.
all
()
.
order_by
(
'-editDateTime'
)[:
2
]
if
newest_cve
.
count
()
<
1
:
newest_cve
=
Bugs
.
objects
.
all
()
.
order_by
(
'-datetime'
)[:
2
]
newest_post_list
[
'publication'
]
=
newest_publication
newest_post_list
[
'article'
]
=
newest_article
newest_post_list
[
'cve'
]
=
newest_cve
...
...
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