Commit 8463fee0 by liuyingying

publication

parent d893c9e8
......@@ -253,11 +253,28 @@
let journalname = $('input[name="journalname"]').val();
let date = $('#date_input').val();
let type = $('select[name="type"] option:selected').val();
let myfile = $("input[name='myfile']")[0].files[0];
let storage = window.localStorage;
let username = storage.username;
let isPublish = $('#isPublish option:selected').val();
let myfile = $("input[name='myfile']")[0].files[0];
let formatData = new FormData();
console.log($("input[name='myfile']")[0].files.length);
console.log($('select[name="type"] option:selected').val());
if($("input[name='myfile']")[0].files.length<=0){
$('#error_log').empty();
$('#error_log').append('请上传文件');
return;
}else if(type==0){
$('#error_log').empty();
$('#error_log').append('请选择发表物类型');
return;
}else if(!title||!authors||!journalname||!date){
$('#error_log').empty();
$('#error_log').append('请填写所有信息');
return;
}
else{
$('#error_log').empty();
formatData.append("myfile", myfile);
formatData.append("title", title);
formatData.append("authors", authors);
......@@ -285,6 +302,9 @@
}
});
}
}
function editPublication(pubID){
show_edit();
let html =
......
......@@ -461,7 +461,7 @@ def add_publication(request):
Publications.objects.create(pubID=pubID, title=title,link=link, messages='kidding', authors = authors,journalname=journalname,uploadByUser=uploadby,date=date,publishType=publishType, isOpen=isPublish)
except ProgrammingError as e:
return JsonResponse({"message": 0})
authorArr = authors.split(',').strip()
authorArr = authors.split(',')
print(authorArr)
for author in authorArr:
users_list = User.objects.all().values('name')
......
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