diff options
Diffstat (limited to 'gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py')
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py index 718dd90..e4867b9 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py @@ -1,14 +1,13 @@ - from django.http import HttpResponse from django.shortcuts import render_to_response # , render from django.template import RequestContext from gnowsys_ndf.ndf.models import * -from gnowsys_ndf.ndf.views.page import * +from gnowsys_ndf.ndf.views.page import page +from gnowsys_ndf.ndf.views.file import file +from gnowsys_ndf.ndf.views.group import group_dashboard from gnowsys_ndf.ndf.views.methods import * - - def trash_resource(request,group_id,node_id): node = node_collection.find_one({"_id":ObjectId(node_id)}) trash_node = node_collection.find_one({"name":"Trash"}); @@ -17,12 +16,20 @@ def trash_resource(request,group_id,node_id): #fetch the tarsh group id if trash_node._id not in node.group_set: node.group_set.append(trash_node._id) - print "node",node.group_set node.save() - return (eval('page')(request, group_id)) - + get_member_of = node_collection.find_one({"_id":{'$in':node.member_of}}) + if get_member_of.name == 'Page': + return (eval('page')(request, group_id)) + elif get_member_of.name == 'File': + return(eval('file')(request, group_id)) + else: + return(eval('group_dashboard')(request, group_id)) + def delete_resource(request,group_id): node_id = request.GET.getlist('node_id','')[0] - delete_node(ObjectId(node_id),deletion_type=1) + if node_id: + delete_node(ObjectId(node_id),deletion_type=1) + else: + return HttpResponse("Nothing Deleted.") return HttpResponse("Deleted Successfully") |