Commit cccf1a82 authored by c24b's avatar c24b

M [TPL+JS] reload

parent a7f6e667
......@@ -54,8 +54,7 @@ class ProjectList(APIView):
# project = check_rights(request, project)
uids = []
for node in projects:
node.delete(synchronize_session=False)
#session.delete(node)
session.delete(node)
session.commit()
uids.append(node.id)
return Response({"detail":"Deleted %i projects" %len(uids)}, status=HTTP_204_NO_CONTENT)
......@@ -106,19 +105,20 @@ class ProjectView(APIView):
def delete(self, request, project_id):
'''DELETE project'''
node = session.query(Node).filter(Node.id == project_id).first()
print("DELETE project")
if node is None:
print("Not Found")
return Response({'detail' : "PROJECT Node #%s not found" %(project_id) },
status = HTTP_404_NOT_FOUND)
else:
print(">", node)
check_rights(request, project_id)
try:
check_rights(request, project_id)
except Exception as e:
return Response({'detail' : "Unauthorized" %(project_id) },
status= 403)
session.delete(node)
print("delete")
session.commit()
print("commit")
return Response({"detail": "Successfully deleted Node #%s" %project_id}, 200)
return Response({"detail": "Successfully deleted Node #%s" %project_id}, status= 204)
def put(self, request, project_id):
'''UPDATE project '''
......@@ -129,7 +129,7 @@ class ProjectView(APIView):
status = HTTP_404_NOT_FOUND)
check_rights(request, project_id)
params = get_parameters(request)
print(params)
# print(params)
#u_project = deepcopy(project)
for key, val in params.items():
if len(val) == 0:
......
......@@ -283,7 +283,6 @@ $(document).on("hover", "button", function(){
// checkbox with BUTTON #delete, #edit #refresh
//DELETE MULTI
$(document).on("click","#delete", function(){
//alert("Delete");
var selected = selectedUrls();
selected.forEach(function(url) {
deleteOne(url);
......@@ -298,12 +297,12 @@ $(document).on("click","#edit", function(){
// selected.forEach(function(url) {
// editOne(url, data);
// });
alert("Not Implemented Yet")
//alert("Not Implemented Yet")
});
//RECALC MULTI
$(document).on("click","#recalculate", function(){
alert("Recalculate");
//alert("Recalculate");
var selected = selectedIds();
selected.forEach(function(id) {
recalculateOne(id);
......@@ -316,9 +315,7 @@ $(document).on("click","#recalculate", function(){
// UNIQUE DELETION
$(document).on("click", ".delete", function() {
var url = $( this ).data("url");
alert(url);
deleteOne(url);
alert("delete");
});
//UNIQUE EDITION
......
......@@ -130,9 +130,11 @@
<span class="glyphicon glyphicon-trash pull-right" aria-hidden="true"></span>
</button>
<!-- REFRESH PROJECT -->
<!--
<button type="button" class="btn btn-default refresh pull-right" data-id="{id}">
<span class="glyphicon glyphicon-refresh pull-right" aria-hidden="true"></span>
<span class="glyphicon glyphicon-refresh pull-right" aria-hidden="true"></span>
</button>
-->
</div>
<div id="project_status">
<!-- Here add nb of the corpus? -->
......
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