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
1bcfb3c0
Commit
1bcfb3c0
authored
Apr 24, 2020
by
liuyingying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
天呐好饿
parent
65e908e1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
5 deletions
+95
-5
style.css
Hunter_ht/hunter/static/hunter/style.css
+33
-4
index.html
Hunter_ht/hunter/templates/hunter/index.html
+1
-0
user.html
Hunter_ht/hunter/templates/hunter/user.html
+0
-0
urls.py
Hunter_ht/hunter/urls.py
+4
-1
views.py
Hunter_ht/hunter/views.py
+57
-0
No files found.
Hunter_ht/hunter/static/hunter/style.css
View file @
1bcfb3c0
...
@@ -82,7 +82,7 @@ button{
...
@@ -82,7 +82,7 @@ button{
color
:
white
;
color
:
white
;
}
}
#login_btn
,
#submit_btn
{
#login_btn
,
#submit_btn
{
background
:
#
ffffff
;
background
:
#
6e829e
;
font-size
:
16px
;
font-size
:
16px
;
}
}
...
@@ -443,7 +443,7 @@ footer .copyright a:hover{
...
@@ -443,7 +443,7 @@ footer .copyright a:hover{
width
:
100%
;
width
:
100%
;
height
:
50px
;
height
:
50px
;
}
}
#edit_content
span
{
#edit_content
label
{
width
:
25%
;
width
:
25%
;
height
:
45px
;
height
:
45px
;
float
:
left
;
float
:
left
;
...
@@ -451,7 +451,7 @@ footer .copyright a:hover{
...
@@ -451,7 +451,7 @@ footer .copyright a:hover{
line-height
:
45px
;
line-height
:
45px
;
text-align
:
right
;
text-align
:
right
;
}
}
#edit_content
input
{
#edit_content
>
form
>
div
>
input
{
width
:
65%
;
width
:
65%
;
height
:
45px
;
height
:
45px
;
font-size
:
16px
;
font-size
:
16px
;
...
@@ -532,7 +532,6 @@ section > .smaller_box{
...
@@ -532,7 +532,6 @@ section > .smaller_box{
.smaller_wrap
button
{
.smaller_wrap
button
{
border
:
none
;
border
:
none
;
outline
:
none
;
outline
:
none
;
background-image
:
url("./images/logo.ico")
;
}
}
.smaller_wrap
blockquote
{
.smaller_wrap
blockquote
{
padding
:
10px
0
;
padding
:
10px
0
;
...
@@ -540,3 +539,32 @@ section > .smaller_box{
...
@@ -540,3 +539,32 @@ section > .smaller_box{
.smaller_wrap
blockquote
>
p
{
.smaller_wrap
blockquote
>
p
{
font-size
:
18px
;
font-size
:
18px
;
}
}
.add_one
{
width
:
100%
;
height
:
40px
;
}
.add_one
button
{
width
:
30px
;
height
:
30px
;
float
:
right
;
border-radius
:
15px
;
}
.add_one
button
svg
{
margin
:
5px
;
}
.add_one
button
:hover
svg
{
width
:
30px
;
height
:
30px
;
border-radius
:
15px
;
margin
:
0
;
}
.myfile
{
float
:
right
;
}
.myfile
>
input
{
background
:
transparent
!important
;
border
:
none
!important
;
outline
:
none
!important
;
display
:
block
;
}
\ No newline at end of file
Hunter_ht/hunter/templates/hunter/index.html
View file @
1bcfb3c0
...
@@ -66,6 +66,7 @@
...
@@ -66,6 +66,7 @@
</ul>
</ul>
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
...
...
Hunter_ht/hunter/templates/hunter/user.html
View file @
1bcfb3c0
This diff is collapsed.
Click to expand it.
Hunter_ht/hunter/urls.py
View file @
1bcfb3c0
...
@@ -9,5 +9,7 @@ urlpatterns = [
...
@@ -9,5 +9,7 @@ urlpatterns = [
# path('<int:pk>/article/', views.ArticleDetail.as_view(), name='article'),
# path('<int:pk>/article/', views.ArticleDetail.as_view(), name='article'),
path
(
'user/<int:user_id>/'
,
views
.
user
,
name
=
'user'
),
path
(
'user/<int:user_id>/'
,
views
.
user
,
name
=
'user'
),
path
(
'article/<int:article_id>/'
,
views
.
article
,
name
=
'article'
),
path
(
'article/<int:article_id>/'
,
views
.
article
,
name
=
'article'
),
path
(
'login/'
,
views
.
login
,
name
=
'login'
)
path
(
'login/'
,
views
.
login
,
name
=
'login'
),
path
(
'delete/publication/<int:pub_id>'
,
views
.
delete_publication
,
name
=
'delete_publication'
),
path
(
'add/publication/'
,
views
.
add_publication
,
name
=
'add_publication'
),
]
]
\ No newline at end of file
Hunter_ht/hunter/views.py
View file @
1bcfb3c0
...
@@ -4,6 +4,10 @@ from .models import *
...
@@ -4,6 +4,10 @@ from .models import *
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.http
import
JsonResponse
from
django.http
import
JsonResponse
from
django.views.decorators.csrf
import
csrf_exempt
from
django.views.decorators.csrf
import
csrf_exempt
import
os
from
django.db.utils
import
ProgrammingError
from
django.shortcuts
import
redirect
from
django.core.exceptions
import
ValidationError
import
json
import
json
from
django.views
import
generic
from
django.views
import
generic
from
django.db.models.aggregates
import
Count
from
django.db.models.aggregates
import
Count
...
@@ -144,3 +148,56 @@ def user(request, user_id):
...
@@ -144,3 +148,56 @@ def user(request, user_id):
def
article
(
request
,
article_id
):
def
article
(
request
,
article_id
):
art
=
get_object_or_404
(
Articles
,
pk
=
article_id
)
art
=
get_object_or_404
(
Articles
,
pk
=
article_id
)
return
render
(
request
,
'hunter/article.html'
,
{
'article'
:
art
})
return
render
(
request
,
'hunter/article.html'
,
{
'article'
:
art
})
def
delete_publication
(
request
,
pub_id
):
print
(
pub_id
)
try
:
PubToUser
.
objects
.
filter
(
pubID
=
pub_id
)
.
delete
()
Publications
.
objects
.
filter
(
pubID
=
pub_id
)
.
delete
()
except
ObjectDoesNotExist
as
e
:
response
=
JsonResponse
({
"message"
:
0
})
return
response
response
=
JsonResponse
({
"message"
:
1
})
return
response
@csrf_exempt
def
add_publication
(
request
):
title
=
request
.
POST
[
'title'
]
print
(
title
)
authors
=
request
.
POST
[
'authors'
]
myfile
=
request
.
FILES
[
'myfile'
]
str
=
','
.
decode
(
'utf-8'
)
authors
=
authors
.
replace
(
str
,
','
)
journalname
=
request
.
POST
.
get
(
'journalname'
)
date
=
request
.
POST
.
get
(
'date'
)
index
=
request
.
POST
.
get
(
'index'
)
if
Publications
.
objects
.
last
()
is
None
:
pubID
=
1
else
:
pubID
=
Publications
.
objects
.
last
()
.
pubID
+
1
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
destination
=
os
.
path
.
join
(
BASE_DIR
,
'hunter'
,
'static'
,
'hunter/publications'
,
myfile
.
name
)
if
os
.
path
.
exists
(
destination
):
os
.
remove
(
destination
)
with
open
(
destination
,
'wb+'
)
as
dest
:
for
chunk
in
myfile
.
chunks
():
dest
.
write
(
chunk
)
dest
.
close
()
link
=
os
.
path
.
join
(
'static'
,
'publications'
,
myfile
.
name
)
try
:
Publications
.
objects
.
create
(
pubID
=
pubID
,
title
=
title
,
link
=
link
,
messages
=
'kidding'
,
authors
=
authors
,
journalname
=
journalname
,
date
=
date
,
indexType
=
index
)
except
ProgrammingError
as
e
:
return
render
(
request
,
'user.html'
,
{
'message'
:
'Publications表错误:'
+
e
})
authorArr
=
authors
.
split
(
','
)
for
author
in
authorArr
:
try
:
PubToUser
.
objects
.
create
(
pubID
=
pubID
,
username
=
author
)
return
redirect
(
request
,
'index.html'
,
{
'uploadMessage'
:
'文件上传成功'
})
except
ProgrammingError
as
e
:
return
render
(
request
,
'index.html'
,
{
'uploadError'
:
'PubToUser数据表错误:'
+
e
})
# message["warning"] = "上传成功"
# return HttpResponse(json.dumps(message), content_type='application/json')
return
redirect
(
request
,
'index.html'
)
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