Commit 6215e057 by liuyingying

删除文章

parent 935dea64
...@@ -205,6 +205,7 @@ ...@@ -205,6 +205,7 @@
<li>{{ art.author }}</li> <li>{{ art.author }}</li>
<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>
<li class="small_text right"><a target="_blank" download="{{ art.attachment }}" href="{% static 'hunter/articles/' %}{{ art.attachment }}">{{ art.attachment }}</a></li>
</ul> </ul>
{% endfor %} {% endfor %}
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
<blockquote ><p>{{ year }}</p></blockquote> <blockquote ><p>{{ year }}</p></blockquote>
{% if arts %} {% if arts %}
{% for art in arts %} {% for art in arts %}
<ul> <ul id="articleid{{ art.articleID }}">
<li class="big_text"> <li class="big_text">
<a href="{% url 'hunter:article' art.articleID %}" target="_blank">{{ art.title }}</a> <a href="{% url 'hunter:article' art.articleID %}" target="_blank">{{ art.title }}</a>
</li> </li>
...@@ -321,7 +321,28 @@ ...@@ -321,7 +321,28 @@
function deleArt(artid){ 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(){ function addCVE(){
submit_what = 'cve'; submit_what = 'cve';
......
...@@ -272,9 +272,9 @@ def delete_cve(request): ...@@ -272,9 +272,9 @@ def delete_cve(request):
@csrf_exempt @csrf_exempt
def delete_article(request): def delete_article(request):
cve_id = request.POST['cve_id'] article_id = request.POST['article_id']
try: try:
Bugs.objects.filter(identifier=cve_id).delete() Articles.objects.filter(articleID=article_id).delete()
response = JsonResponse({"message": 1}) response = JsonResponse({"message": 1})
return response return response
except ProgrammingError as e: 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