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
8fbfa2d4
Commit
8fbfa2d4
authored
Apr 23, 2020
by
liuyingying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人生真复杂
parent
f8221874
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
index.html
Hunter_ht/hunter/templates/hunter/index.html
+7
-2
views.py
Hunter_ht/hunter/views.py
+11
-9
No files found.
Hunter_ht/hunter/templates/hunter/index.html
View file @
8fbfa2d4
...
...
@@ -13,7 +13,7 @@
<div
id=
"login_wrap"
>
<div
id=
"input_div"
>
<input
type=
"text"
placeholder=
"username"
autofocus=
"autofocus"
>
<input
type=
"password"
placeholder=
"password"
>
<input
onkeydown=
"keylogin()"
type=
"password"
placeholder=
"password"
>
</div>
<div
id=
"error_log"
></div>
<div
id=
"btn_div"
>
...
...
@@ -299,13 +299,18 @@
}
function
login_success
(
name
,
userid
){
$
(
'#top_bar'
).
empty
();
$
(
'#top_bar'
).
append
(
"<ul><li onclick='logout()'>退出</li><li
id="
+
userid
+
" title='点击进入个人中心'>"
+
name
+
"
</li></ul>"
);
$
(
'#top_bar'
).
append
(
"<ul><li onclick='logout()'>退出</li><li
title='点击进入个人中心'><a href='/user/"
+
userid
+
"/' target='_blank'>"
+
name
+
"</a>
</li></ul>"
);
hide_log
();
}
function
login_fail
(
message
){
$
(
'#error_log'
).
empty
();
$
(
'#error_log'
).
append
(
message
);
}
function
keylogin
(){
if
(
event
.
keyCode
===
13
)
{
login
();
}
}
function
logout
(){
$
(
'#top_bar'
).
empty
();
$
(
'#top_bar'
).
append
(
'<button onclick="show_log()">登录</button>'
);
...
...
Hunter_ht/hunter/views.py
View file @
8fbfa2d4
...
...
@@ -94,12 +94,14 @@ def login(request):
def
user
(
request
,
user_id
):
u
=
get_object_or_404
(
User
,
pk
=
user_id
)
u
=
User
.
objects
.
get
(
userID
=
user_id
)
print
(
u
.
name_hanzi
)
username
=
u
.
name
my_publication_year_list
=
{}
pub_ids
=
PubToUser
.
objects
.
filter
(
username
=
u
.
name
)
pub_ids
=
PubToUser
.
objects
.
filter
(
username
=
u
sername
)
.
all
()
.
values
(
"pubID"
)
for
pub_id
in
pub_ids
:
pub
=
get_object_or_404
(
Publications
,
pk
=
pub_id
)
print
(
pub_id
)
pub
=
get_object_or_404
(
Publications
,
pk
=
pub_id
[
'pubID'
])
year
=
str
(
pub
.
date
)[
0
:
4
]
pub
.
date
=
str
(
pub
.
date
)[
5
:
10
]
if
year
in
my_publication_year_list
.
keys
():
...
...
@@ -107,7 +109,7 @@ def user(request, user_id):
else
:
my_publication_year_list
[
year
]
=
[
pub
]
my_article_list
=
Articles
.
objects
.
order_by
(
'-editDateTime'
)
my_article_list
=
Articles
.
objects
.
filter
(
authorID
=
user_id
)
.
order_by
(
'-editDateTime'
)
my_article_year_list
=
{}
for
art
in
my_article_list
:
year
=
str
(
art
.
editDateTime
)[
0
:
4
]
...
...
@@ -119,7 +121,7 @@ def user(request, user_id):
else
:
my_article_year_list
[
year
]
=
[
art
]
my_bug_list
=
Bugs
.
objects
.
filter
(
owner
=
u
.
name
)
.
order_by
(
'-datetime'
)
my_bug_list
=
Bugs
.
objects
.
filter
(
owner
=
u
ser
name
)
.
order_by
(
'-datetime'
)
my_cve_year_list
=
{}
for
cve
in
my_bug_list
:
year
=
str
(
cve
.
datetime
)[
0
:
4
]
...
...
@@ -131,9 +133,9 @@ def user(request, user_id):
my_cve_year_list
[
year
]
=
[
cve
]
context
=
{
'user'
:
u
,
'
my_
publication_year_list'
:
my_publication_year_list
,
'
my_
cve_year_list'
:
my_cve_year_list
,
'
my_
article_year_list'
:
my_article_year_list
,
'publication_year_list'
:
my_publication_year_list
,
'cve_year_list'
:
my_cve_year_list
,
'article_year_list'
:
my_article_year_list
,
}
return
render
(
request
,
'hunter/user.html'
,
context
)
...
...
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