Commit 529effef by Xu Zhou

简化了目录结构,去掉多余层级的hunter目录。

parent 7975327a
...@@ -18,5 +18,5 @@ from django.urls import path, include ...@@ -18,5 +18,5 @@ from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('', include('hunter.urls')), path('', include('hunter.urls')),
path('admin/', admin.site.urls), path('djadmin/', admin.site.urls),
] ]
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
{% load static %} {% load static %}
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>管理员面板</title> <title>管理员面板</title>
<link rel="icon" href="{% static 'hunter/images/logo.ico' %}" type="text/icon"> <link rel="icon" href="{% static 'images/logo.ico' %}" type="text/icon">
<link rel="stylesheet" href="{% static 'hunter/bootstrap.css' %}"> <link rel="stylesheet" href="{% static 'bootstrap.css' %}">
<link rel="stylesheet" href="{% static 'hunter/admin.css' %}"> <link rel="stylesheet" href="{% static 'admin.css' %}">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
<script src="{% static 'hunter/jquery.form.js' %}"></script> <script src="{% static 'jquery.form.js' %}"></script>
<script type="text/javascript" src="{% static 'hunter/md/showdown.js' %}"></script> <script type="text/javascript" src="{% static 'md/showdown.js' %}"></script>
<script type="text/javascript" src="{% static 'hunter/md5.js' %}"></script> <script type="text/javascript" src="{% static 'md5.js' %}"></script>
</head> </head>
<body> <body>
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>HT-{{ article.title }}</title> <title>HT-{{ article.title }}</title>
{% load static %} {% load static %}
<link rel="icon" href="{% static 'hunter/images/logo.ico' %}" type="text/icon"> <link rel="icon" href="{% static 'images/logo.ico' %}" type="text/icon">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'hunter/md/markdown.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'md/markdown.css' %}">
<script type="text/javascript" src="{% static 'hunter/md/showdown.js' %}"></script> <script type="text/javascript" src="{% static 'md/showdown.js' %}"></script>
</head> </head>
<body> <body>
<nav> <nav>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div id="content_view" style="display: none;">{{ article.content }}</div> <div id="content_view" style="display: none;">{{ article.content }}</div>
</div> </div>
<div class="attachment" id="attachment" > <div class="attachment" id="attachment" >
<a target="_blank" download="{{ article.attachment }}" href="{% static 'hunter/articles/' %}{{ article.attachment }}">{{ article.attachment }}</a> <a target="_blank" download="{{ article.attachment }}" href="{% static 'articles/' %}{{ article.attachment }}">{{ article.attachment }}</a>
</div> </div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>HT-个人详情页</title> <title>HT-个人详情页</title>
{% load static %} {% load static %}
<link rel="icon" href="{% static 'hunter/images/logo.ico' %}" type="text/icon"> <link rel="icon" href="{% static 'images/logo.ico' %}" type="text/icon">
<link rel="stylesheet" type="text/css" href="{% static 'hunter/detail.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'detail.css' %}">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
</head> </head>
<body> <body>
<div id="resume"> <div id="resume">
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>编辑文章</title> <title>编辑文章</title>
{% load static %} {% load static %}
<link rel="icon" href="{% static 'hunter/images/logo.ico' %}" type="text/icon"> <link rel="icon" href="{% static 'images/logo.ico' %}" type="text/icon">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'hunter/md/markdown.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'md/markdown.css' %}">
<script type="text/javascript" src="{% static 'hunter/md/showdown.js' %}"></script> <script type="text/javascript" src="{% static 'md/showdown.js' %}"></script>
<script type="text/javascript" src="{% static 'hunter/bootstrap.min.js' %}"></script> <script type="text/javascript" src="{% static 'bootstrap.min.js' %}"></script>
</head> </head>
<body> <body>
<nav> <nav>
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>野旷天低树江清月近人</title> <title>野旷天低树江清月近人</title>
{% load static %} {% load static %}
<link rel="icon" href="{% static 'hunter/images/logo.ico' %}" type="text/icon"> <link rel="icon" href="{% static 'images/logo.ico' %}" type="text/icon">
<link rel="stylesheet" type="text/css" href="{% static 'hunter/style.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
<script type="text/javascript" src="{% static 'hunter/md5.js' %}"></script> <script type="text/javascript" src="{% static 'md5.js' %}"></script>
</head> </head>
<body> <body>
<div id="login_div" class=""> <div id="login_div" class="">
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
{% if publications %} {% if publications %}
{% for publication in publications %} {% for publication in publications %}
<ul> <ul>
<li class="big_text li_long"><a href="{% static 'hunter/publications/' %}{{ publication.link }}" target="_blank">{{ publication.title }}</a></li> <li class="big_text li_long"><a href="{% static 'publications/' %}{{ publication.link }}" target="_blank">{{ publication.title }}</a></li>
<li class="middle_text right">{{ publication.date }}</li> <li class="middle_text right">{{ publication.date }}</li>
<li class="right">{{ publication.journalname }}</li> <li class="right">{{ publication.journalname }}</li>
<li class="right">{{ publication.publishType }}</li> <li class="right">{{ publication.publishType }}</li>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
<li class="middle_text right">{{ art.editDateTime }}</li> <li class="middle_text right">{{ art.editDateTime }}</li>
<li class="small_text right">{{ art.authorID }}</li> <li class="small_text right">{{ art.authorID }}</li>
{% if art.attachment %} {% if art.attachment %}
<li class="small_text right"><a target="_blank" download="{{ art.attachment }}" href="{% static 'hunter/articles/' %}{{ art.attachment }}">{{ art.attachment }}</a></li> <li class="small_text right"><a target="_blank" download="{{ art.attachment }}" href="{% static 'articles/' %}{{ art.attachment }}">{{ art.attachment }}</a></li>
{% endif %} {% endif %}
</ul> </ul>
{% endfor %} {% endfor %}
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>修改个人信息</title> <title>修改个人信息</title>
{% load static %} {% load static %}
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
<script type="text/javascript" src="{% static 'hunter/md5.js' %}"></script> <script type="text/javascript" src="{% static 'md5.js' %}"></script>
</head> </head>
<style type="text/css"> <style type="text/css">
*{ *{
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>HT-个人中心 </title> <title>HT-个人中心 </title>
{% load static %} {% load static %}
<link rel="icon" href="{% static 'hunter/images/logo.ico' %}" type="text/icon"> <link rel="icon" href="{% static 'images/logo.ico' %}" type="text/icon">
<link rel="stylesheet" type="text/css" href="{% static 'hunter/style.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
<script src="{% static 'hunter/jquery.form.js' %}"></script> <script src="{% static 'jquery.form.js' %}"></script>
</head> </head>
<body> <body>
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
{% if publications %} {% if publications %}
{% for publication in publications %} {% for publication in publications %}
<ul id="pubid{{ publication.pubID }}"> <ul id="pubid{{ publication.pubID }}">
<li class="big_text li_long"><a href="{% static 'hunter/publications/' %}{{ publication.link }}" target="_blank">{{ publication.title }}</a></li> <li class="big_text li_long"><a href="{% static 'publications/' %}{{ publication.link }}" target="_blank">{{ publication.title }}</a></li>
<li class="right"><button class="dele_img" onclick="delePub({{ publication.pubID }})"></button></li> <li class="right"><button class="dele_img" onclick="delePub({{ publication.pubID }})"></button></li>
<li class="right"><button class="edit_img" onclick="editPublication({{ publication.pubID }})"></button></li> <li class="right"><button class="edit_img" onclick="editPublication({{ publication.pubID }})"></button></li>
<li class="right"> <li class="right">
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>个人中心-积分纪录 </title> <title>个人中心-积分纪录 </title>
{% load static %} {% load static %}
<link rel="icon" href="{% static 'hunter/images/logo.ico' %}" type="text/icon"> <link rel="icon" href="{% static 'images/logo.ico' %}" type="text/icon">
<link rel="stylesheet" type="text/css" href="{% static 'hunter/style.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'hunter/detail.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'detail.css' %}">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
<script src="{% static 'hunter/jquery.form.js' %}"></script> <script src="{% static 'jquery.form.js' %}"></script>
<style type="text/css"> <style type="text/css">
ul li{ ul li{
display: block; display: block;
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>写文章</title> <title>写文章</title>
{% load static %} {% load static %}
<link rel="icon" href="{% static 'hunter/images/logo.ico' %}" type="text/icon"> <link rel="icon" href="{% static 'images/logo.ico' %}" type="text/icon">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script> <script src="{% static 'jquery-1.9.1.min.js' %}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'hunter/md/markdown.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'md/markdown.css' %}">
<script type="text/javascript" src="{% static 'hunter/md/showdown.js' %}"></script> <script type="text/javascript" src="{% static 'md/showdown.js' %}"></script>
<script type="text/javascript" src="{% static 'hunter/bootstrap.min.js' %}"></script> <script type="text/javascript" src="{% static 'bootstrap.min.js' %}"></script>
</head> </head>
<body> <body>
<nav> <nav>
......
...@@ -100,7 +100,7 @@ def index(request): ...@@ -100,7 +100,7 @@ def index(request):
newest_publication = Publications.objects.filter(date__gte=start, isOpen='1').order_by('-editDateTime') newest_publication = Publications.objects.filter(date__gte=start, isOpen='1').order_by('-editDateTime')
for pub in newest_publication: for pub in newest_publication:
pub.author = pub.uploadByUser pub.author = pub.uploadByUser
pub.url = '/static/hunter/publications/'+pub.link.split('/')[-1] pub.url = '/static/publications/'+pub.link.split('/')[-1]
pub.date = str(pub.date)[5:10] 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).order_by('-editDateTime')
for art in newest_article: for art in newest_article:
...@@ -127,7 +127,7 @@ def index(request): ...@@ -127,7 +127,7 @@ def index(request):
'article_year_list': article_year_list, 'article_year_list': article_year_list,
'newest_post_list': newest_post_list, 'newest_post_list': newest_post_list,
} }
return render(request, 'hunter/index.html', context) return render(request, 'index.html', context)
@csrf_exempt @csrf_exempt
...@@ -210,7 +210,7 @@ def user(request, user_id): ...@@ -210,7 +210,7 @@ def user(request, user_id):
'article_year_list': my_article_year_list, 'article_year_list': my_article_year_list,
} }
print("display user: ", usr) print("display user: ", usr)
return render(request, 'hunter/user.html', context) return render(request, 'user.html', context)
def detail(request, user_id): def detail(request, user_id):
...@@ -265,14 +265,14 @@ def detail(request, user_id): ...@@ -265,14 +265,14 @@ def detail(request, user_id):
'cve_year_list': my_cve_year_list, 'cve_year_list': my_cve_year_list,
'education_list': education_list, 'education_list': education_list,
} }
return render(request, 'hunter/detail.html', context) return render(request, 'detail.html', context)
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)
author = get_object_or_404(User, pk=art.authorID) author = get_object_or_404(User, pk=art.authorID)
art.author = author.name art.author = author.name
return render(request, 'hunter/article.html', {'article': art}) return render(request, 'article.html', {'article': art})
@csrf_exempt @csrf_exempt
...@@ -294,7 +294,7 @@ def write_art(request): ...@@ -294,7 +294,7 @@ def write_art(request):
return JsonResponse({'message': 0, 'error': '文件已存在'}) return JsonResponse({'message': 0, 'error': '文件已存在'})
else: else:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
destination = os.path.join(BASE_DIR, 'hunter', 'static', 'hunter/articles', myfile.name) destination = os.path.join(BASE_DIR, 'hunter', 'static', 'articles', myfile.name)
if os.path.exists(destination): if os.path.exists(destination):
os.remove(destination) os.remove(destination)
with open(destination, 'wb+') as dest: with open(destination, 'wb+') as dest:
...@@ -319,7 +319,7 @@ def write_art(request): ...@@ -319,7 +319,7 @@ def write_art(request):
except ProgrammingError as e: except ProgrammingError as e:
response = JsonResponse({"message": 0, 'error': '数据库错误'}) response = JsonResponse({"message": 0, 'error': '数据库错误'})
return response return response
return render(request, 'hunter/write.html')\ return render(request, 'write.html')\
@csrf_exempt @csrf_exempt
...@@ -345,7 +345,7 @@ def save_edit_art(request): ...@@ -345,7 +345,7 @@ def save_edit_art(request):
if int(is_have_file) > 0: if int(is_have_file) > 0:
myfile = request.FILES['myfile'] myfile = request.FILES['myfile']
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
destination = os.path.join(BASE_DIR, 'hunter', 'static', 'hunter/articles', myfile.name) destination = os.path.join(BASE_DIR, 'hunter', 'static', 'articles', myfile.name)
if os.path.exists(destination): if os.path.exists(destination):
os.remove(destination) os.remove(destination)
with open(destination, 'wb+') as dest: with open(destination, 'wb+') as dest:
...@@ -402,8 +402,8 @@ def add_url_article(request): ...@@ -402,8 +402,8 @@ def add_url_article(request):
def uploadImg(request): def uploadImg(request):
file_obj = request.FILES.get("image") file_obj = request.FILES.get("image")
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
file_path = os.path.join(BASE_DIR, 'hunter', 'static', 'hunter/articles/images', file_obj.name) file_path = os.path.join(BASE_DIR, 'hunter', 'static', 'articles/images', file_obj.name)
link_path = os.path.join('/static', 'hunter/articles/images', file_obj.name) link_path = os.path.join('/static', 'articles/images', file_obj.name)
with open(file_path,'wb') as f: with open(file_path,'wb') as f:
for chunk in file_obj.chunks(): for chunk in file_obj.chunks():
f.write(chunk) f.write(chunk)
...@@ -484,7 +484,7 @@ def add_publication(request): ...@@ -484,7 +484,7 @@ def add_publication(request):
else: else:
pubID = Publications.objects.last().pubID+1 pubID = Publications.objects.last().pubID+1
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
destination = os.path.join(BASE_DIR,'hunter', 'static', 'hunter/publications', myfile.name) destination = os.path.join(BASE_DIR,'hunter', 'static', 'publications', myfile.name)
if os.path.exists(destination): if os.path.exists(destination):
os.remove(destination) os.remove(destination)
with open(destination,'wb+') as dest: with open(destination,'wb+') as dest:
...@@ -561,7 +561,7 @@ def edit_publication(request): ...@@ -561,7 +561,7 @@ def edit_publication(request):
if isHaveFile == '1': if isHaveFile == '1':
myfile = request.FILES['myfile'] myfile = request.FILES['myfile']
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
destination = os.path.join(BASE_DIR,'hunter', 'static', 'hunter/publications', myfile.name) destination = os.path.join(BASE_DIR,'hunter', 'static', 'publications', myfile.name)
if os.path.exists(destination): if os.path.exists(destination):
os.remove(destination) os.remove(destination)
with open(destination,'wb+') as dest: with open(destination,'wb+') as dest:
...@@ -678,7 +678,7 @@ def profile_edit(request, user_id): ...@@ -678,7 +678,7 @@ def profile_edit(request, user_id):
for item in edu: for item in edu:
item.start=str(item.start)[0:10] item.start=str(item.start)[0:10]
item.stop=str(item.stop)[0:10] item.stop=str(item.stop)[0:10]
return render(request, 'hunter/profile.html', {'user': user, 'edus':edu}) return render(request, 'profile.html', {'user': user, 'edus':edu})
@csrf_exempt @csrf_exempt
...@@ -725,7 +725,7 @@ def profile_submit(request): ...@@ -725,7 +725,7 @@ def profile_submit(request):
def edit_art(request, article_id): def edit_art(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/editArticle.html', {'article': art}) return render(request, 'editArticle.html', {'article': art})
def check_admin_privilage(user_id): def check_admin_privilage(user_id):
...@@ -777,7 +777,7 @@ def admin(request): ...@@ -777,7 +777,7 @@ def admin(request):
else: else:
records = ScoreRecords.objects.all() records = ScoreRecords.objects.all()
print(users) print(users)
return render(request,"hunter/admin.html", locals()) return render(request,"admin.html", locals())
def user_score_records(request): def user_score_records(request):
user_id = None user_id = None
...@@ -787,7 +787,7 @@ def user_score_records(request): ...@@ -787,7 +787,7 @@ def user_score_records(request):
user_id = request.session.get('user_id') user_id = request.session.get('user_id')
if user_id != None: if user_id != None:
records = ScoreRecords.objects.filter(userID = user_id); records = ScoreRecords.objects.filter(userID = user_id);
return render(request,"hunter/user_score.html", locals()) return render(request,"user_score.html", locals())
@csrf_exempt @csrf_exempt
def operator(request): def operator(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment