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>
......@@ -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