Commit 6215e057 by liuyingying

删除文章

parent 935dea64
......@@ -205,6 +205,7 @@
<li>{{ art.author }}</li>
<li class="middle_text right">{{ art.editDateTime }}</li>
<li class="small_text right">{{ art.authorID }}</li>
<li class="small_text right"><a target="_blank" download="{{ art.attachment }}" href="{% static 'hunter/articles/' %}{{ art.attachment }}">{{ art.attachment }}</a></li>
</ul>
{% endfor %}
......
......@@ -130,7 +130,7 @@
<blockquote ><p>{{ year }}</p></blockquote>
{% if arts %}
{% for art in arts %}
<ul>
<ul id="articleid{{ art.articleID }}">
<li class="big_text">
<a href="{% url 'hunter:article' art.articleID %}" target="_blank">{{ art.title }}</a>
</li>
......@@ -140,7 +140,7 @@
{# <li class="right"><button onclick="editArt({{ art.articleID }})"><svg t="1587711451871" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2741" width="20" height="20"><path d="M863.079412 351.09129a29.2569 29.2569 0 0 1 58.5138 0v555.881108a117.027602 117.027602 0 0 1-117.027601 117.027602H219.427602a117.027602 117.027602 0 0 1-117.027602-117.027602V146.292987a117.027602 117.027602 0 0 1 117.027602-117.027602h380.339706a29.2569 29.2569 0 0 1 0 58.513801H219.427602a58.513801 58.513801 0 0 0-58.513801 58.513801v760.679411a58.513801 58.513801 0 0 0 58.513801 58.513801h585.138009a58.513801 58.513801 0 0 0 58.513801-58.513801V351.09129zM855.414104 10.306913a29.2569 29.2569 0 1 1 44.587516 37.916943l-248.683654 292.569005a29.2569 29.2569 0 1 1-44.587516-37.916943l248.683654-292.569005zM307.198303 526.632692h263.312104a29.2569 29.2569 0 0 1 0 58.513801H307.198303a29.2569 29.2569 0 0 1 0-58.513801z m0 175.541403h409.596606a29.2569 29.2569 0 0 1 0 58.513801H307.198303a29.2569 29.2569 0 0 1 0-58.513801z" p-id="2742" fill="#6e829e"></path></svg>#}
{# </button></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>
<li class="small_text right"><a target="_blank" download="{{ art.attachment }}" href="{% static 'hunter/articles/' %}{{ art.attachment }}">{{ art.attachment }}</a></li>
</ul>
{% endfor %}
......@@ -321,7 +321,28 @@
function deleArt(artid){
let is_sure = confirm("确定要删除吗?");
console.log(is_sure);
console.log(artid);
if(is_sure){
$.ajax({
url: '/delete/article/',
type: 'post',
data:{
"article_id":artid,
},
success: function (response) {
if(response['message']){
$('#articleid'+artid).css('display','none');
$('#articleid'+artid).empty();
}
},
error:function (xhr) {
console.error('something went wrong...');
login_fail("something went wrong...");
}
})
}
}
function addCVE(){
submit_what = 'cve';
......
......@@ -272,9 +272,9 @@ def delete_cve(request):
@csrf_exempt
def delete_article(request):
cve_id = request.POST['cve_id']
article_id = request.POST['article_id']
try:
Bugs.objects.filter(identifier=cve_id).delete()
Articles.objects.filter(articleID=article_id).delete()
response = JsonResponse({"message": 1})
return response
except ProgrammingError as e:
......
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