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
478045c6
Commit
478045c6
authored
Jun 17, 2020
by
Duanbj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix:首页展示非公开文章、文章取消发布按钮无效
parent
607c7610
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
user.html
hunter/templates/user.html
+2
-1
view_page.py
hunter/views/view_page.py
+3
-2
No files found.
hunter/templates/user.html
View file @
478045c6
...
...
@@ -819,7 +819,6 @@
var
publish
=
'0'
;
if
(
thisBtn
.
innerText
===
'取消发布'
){
publish
=
'0'
;
console
.
log
(
isOpen
);
}
else
{
publish
=
'2'
}
...
...
@@ -835,9 +834,11 @@
if
(
response
[
'message'
]){
console
.
log
(
thisBtn
);
if
(
publish
===
'2'
){
alert
(
"发布成功,该文章目前为公开状态。"
)
$
(
thisBtn
).
empty
();
$
(
thisBtn
).
append
(
'取消发布'
);
}
else
{
alert
(
"取消成功,该文章目前仅自己可见。"
)
$
(
thisBtn
).
empty
();
$
(
thisBtn
).
append
(
'发布'
);
}
...
...
hunter/views/view_page.py
View file @
478045c6
...
...
@@ -92,9 +92,10 @@ def index_html(request):
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
,
publish
=
2
)
.
order_by
(
'-editDateTime'
)
# 查看7天内是否有新文章,没有则选择已发布的文章中最新的两篇
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
]
newest_article
=
Articles
.
objects
.
filter
(
publish
=
'2'
)
.
order_by
(
'-editDateTime'
)[:
2
]
for
art
in
newest_article
:
users
=
User
.
objects
.
filter
(
userID
=
art
.
authorID
)
.
values
(
'name'
)
art
.
author
=
users
[
0
][
'name'
]
...
...
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